diff --git a/src/send-and-sync.md b/src/send-and-sync.md index c2d26dc..321d443 100644 --- a/src/send-and-sync.md +++ b/src/send-and-sync.md @@ -82,7 +82,7 @@ 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 +```rust,ignore use std::mem::size_of; use std::ptr::NonNull; @@ -114,7 +114,7 @@ to access it. [`Box`][box-doc] implements [`Deref`][deref-doc] and [`DerefMut`][deref-mut-doc] so that you can access the inner value. Let's do that. -```rust +```rust,ignore use std::ops::{Deref, DerefMut}; impl Deref for Carton { @@ -153,7 +153,7 @@ safely be Send unless it shares mutable state with something else without enforcing exclusive access to it. Each `Carton` has a unique pointer, so we're good. -```rust +```rust,ignore // Safety: No one besides us has the raw pointer, so we can safely transfer the // Carton to another thread. unsafe impl Send for Carton {} @@ -166,7 +166,7 @@ write to the pointer, and the borrow checker enforces that mutable references must be exclusive, there are no soundness issues making `Carton` sync either. -```rust +```rust,ignore // Safety: Our implementation of DerefMut requires writers to mutably borrow the // Carton, so the borrow checker will only let us have references to the Carton // on multiple threads if no one has a mutable reference to the Carton.