2020-09-10 22:41:02 -05:00
|
|
|
error[E0277]: `Cell<i32>` cannot be shared between threads safely
|
2022-08-16 01:27:22 -05:00
|
|
|
--> $DIR/generator-print-verbose-2.rs:19:17
|
2020-09-10 22:41:02 -05:00
|
|
|
|
|
2022-08-16 01:27:22 -05:00
|
|
|
LL | assert_send(|| {
|
|
|
|
| _____-----------_^
|
|
|
|
| | |
|
|
|
|
| | required by a bound introduced by this call
|
|
|
|
LL | |
|
|
|
|
LL | | drop(&a);
|
|
|
|
LL | | yield;
|
|
|
|
LL | | });
|
|
|
|
| |_____^ `Cell<i32>` cannot be shared between threads safely
|
2020-09-10 22:41:02 -05:00
|
|
|
|
|
|
|
|
= help: the trait `Sync` is not implemented for `Cell<i32>`
|
2023-01-16 11:51:31 -06:00
|
|
|
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead
|
2022-08-15 15:31:37 -05:00
|
|
|
= note: required for `&'_#4r Cell<i32>` to implement `Send`
|
2022-06-19 13:59:36 -05:00
|
|
|
note: required because it's used within this generator
|
|
|
|
--> $DIR/generator-print-verbose-2.rs:19:17
|
|
|
|
|
|
2022-06-27 00:45:35 -05:00
|
|
|
LL | assert_send(|| {
|
|
|
|
| ^^
|
2021-07-31 11:26:55 -05:00
|
|
|
note: required by a bound in `assert_send`
|
|
|
|
--> $DIR/generator-print-verbose-2.rs:10:23
|
|
|
|
|
|
|
|
|
LL | fn assert_send<T: Send>(_: T) {}
|
|
|
|
| ^^^^ required by this bound in `assert_send`
|
2020-09-10 22:41:02 -05:00
|
|
|
|
|
|
|
error: generator cannot be shared between threads safely
|
2022-08-16 01:27:22 -05:00
|
|
|
--> $DIR/generator-print-verbose-2.rs:12:17
|
|
|
|
|
|
|
|
|
LL | assert_sync(|| {
|
|
|
|
| _________________^
|
|
|
|
LL | |
|
|
|
|
LL | | let a = Cell::new(2);
|
|
|
|
LL | | yield;
|
|
|
|
LL | | });
|
|
|
|
| |_____^ generator is not `Sync`
|
2020-09-10 22:41:02 -05:00
|
|
|
|
|
|
|
|
= help: within `[main::{closure#0} upvar_tys=() {Cell<i32>, ()}]`, the trait `Sync` is not implemented for `Cell<i32>`
|
2023-01-16 11:51:31 -06:00
|
|
|
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead
|
2020-09-10 22:41:02 -05:00
|
|
|
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
|
2021-07-31 11:26:55 -05:00
|
|
|
note: required by a bound in `assert_sync`
|
|
|
|
--> $DIR/generator-print-verbose-2.rs:9:23
|
|
|
|
|
|
|
|
|
LL | fn assert_sync<T: Sync>(_: T) {}
|
|
|
|
| ^^^^ required by this bound in `assert_sync`
|
2020-09-10 22:41:02 -05:00
|
|
|
|
|
|
|
error: aborting due to 2 previous errors
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0277`.
|