From d1c89a828dabf0719fc3061b60bc4b48752c5b98 Mon Sep 17 00:00:00 2001 From: Daniel Franklin Date: Thu, 25 Mar 2021 20:06:24 +0000 Subject: [PATCH] Update src/send-and-sync.md Co-authored-by: Daniel Henry-Mantilla --- src/send-and-sync.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/send-and-sync.md b/src/send-and-sync.md index 97e8b24..1e2bb04 100644 --- a/src/send-and-sync.md +++ b/src/send-and-sync.md @@ -84,10 +84,16 @@ implement Send and Sync. Let's call it a `Carton`. We start by writing code to take a value allocated on the stack and transfer it to the heap. -```rust,ignore -use std::mem::size_of; -use std::ptr; - +```rust +# mod libc { +# pub use ::std::os::raw::{c_int, c_void, size_t}; +# extern "C" { pub fn posix_memalign(memptr: *mut *mut c_void, align: size_t, size: size_t) -> c_int; } +# } +use std::{ + mem::{align_of, size_of}, + ptr, +}; +use libc::c_void; struct Carton(ptr::NonNull); impl Carton {