2020-09-10 22:41:02 -05:00
|
|
|
error[E0277]: `Cell<i32>` cannot be shared between threads safely
|
|
|
|
--> $DIR/generator-print-verbose-2.rs:19:5
|
|
|
|
|
|
|
|
|
LL | fn assert_send<T: Send>(_: T) {}
|
|
|
|
| ---- required by this bound in `assert_send`
|
|
|
|
...
|
|
|
|
LL | assert_send(|| {
|
|
|
|
| ^^^^^^^^^^^ `Cell<i32>` cannot be shared between threads safely
|
|
|
|
|
|
|
|
|
= help: the trait `Sync` is not implemented for `Cell<i32>`
|
2020-09-09 00:18:28 -05:00
|
|
|
= note: required because of the requirements on the impl of `Send` for `&'_#4r Cell<i32>`
|
|
|
|
= note: required because it appears within the type `[main::{closure#1} upvar_tys=(&'_#4r Cell<i32>) _#17t]`
|
2020-09-10 22:41:02 -05:00
|
|
|
|
|
|
|
error: generator cannot be shared between threads safely
|
|
|
|
--> $DIR/generator-print-verbose-2.rs:12:5
|
|
|
|
|
|
|
|
|
LL | fn assert_sync<T: Sync>(_: T) {}
|
|
|
|
| ---- required by this bound in `assert_sync`
|
|
|
|
...
|
|
|
|
LL | assert_sync(|| {
|
|
|
|
| ^^^^^^^^^^^ generator is not `Sync`
|
|
|
|
|
|
|
|
|
= help: within `[main::{closure#0} upvar_tys=() {Cell<i32>, ()}]`, the trait `Sync` is not implemented for `Cell<i32>`
|
|
|
|
note: generator is not `Sync` as this value is used across a yield
|
|
|
|
--> $DIR/generator-print-verbose-2.rs:15:9
|
|
|
|
|
|
|
|
|
LL | let a = Cell::new(2);
|
|
|
|
| - has type `Cell<i32>` which is not `Sync`
|
|
|
|
LL | yield;
|
|
|
|
| ^^^^^ yield occurs here, with `a` maybe used later
|
|
|
|
LL | });
|
|
|
|
| - `a` is later dropped here
|
|
|
|
|
|
|
|
error: aborting due to 2 previous errors
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0277`.
|