error[E0277]: `Cell` cannot be shared between threads safely --> $DIR/generator-print-verbose-2.rs:22:17 | LL | assert_send(|| { | _____-----------_^ | | | | | required by a bound introduced by this call LL | | LL | | drop(&a); LL | | yield; LL | | }); | |_____^ `Cell` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `Cell` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead = note: required for `&'_#4r Cell` to implement `Send` note: required because it's used within this generator --> $DIR/generator-print-verbose-2.rs:22:17 | LL | assert_send(|| { | ^^ note: required by a bound in `assert_send` --> $DIR/generator-print-verbose-2.rs:13:23 | LL | fn assert_send(_: T) {} | ^^^^ required by this bound in `assert_send` error: generator cannot be shared between threads safely --> $DIR/generator-print-verbose-2.rs:15:17 | LL | assert_sync(|| { | _________________^ LL | | LL | | let a = Cell::new(2); LL | | yield; LL | | }); | |_____^ generator is not `Sync` | = help: within `[main::{closure#0} upvar_tys=() {Cell, ()}]`, the trait `Sync` is not implemented for `Cell` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead note: generator is not `Sync` as this value is used across a yield --> $DIR/generator-print-verbose-2.rs:18:9 | LL | let a = Cell::new(2); | - has type `Cell` which is not `Sync` LL | yield; | ^^^^^ yield occurs here, with `a` maybe used later LL | }); | - `a` is later dropped here note: required by a bound in `assert_sync` --> $DIR/generator-print-verbose-2.rs:12:23 | LL | fn assert_sync(_: T) {} | ^^^^ required by this bound in `assert_sync` error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`.