-error[E0277]: `std::cell::Cell<i32>` cannot be shared between threads safely
- --> $DIR/not-send-sync.rs:26:5
+error[E0277]: `Cell<i32>` cannot be shared between threads safely
+ --> $DIR/not-send-sync.rs:16:5
|
LL | assert_send(|| {
- | ^^^^^^^^^^^ `std::cell::Cell<i32>` cannot be shared between threads safely
+ | ^^^^^^^^^^^ `Cell<i32>` cannot be shared between threads safely
+ |
+ = help: the trait `Sync` is not implemented for `Cell<i32>`
+ = note: required because of the requirements on the impl of `Send` for `&Cell<i32>`
+note: required because it's used within this generator
+ --> $DIR/not-send-sync.rs:16:17
|
- = help: the trait `std::marker::Sync` is not implemented for `std::cell::Cell<i32>`
- = note: required because of the requirements on the impl of `std::marker::Send` for `&std::cell::Cell<i32>`
- = note: required because it appears within the type `[generator@$DIR/not-send-sync.rs:26:17: 30:6 a:&std::cell::Cell<i32> _]`
-note: required by `main::assert_send`
- --> $DIR/not-send-sync.rs:17:5
+LL | assert_send(|| {
+ | _________________^
+LL | |
+LL | | drop(&a);
+LL | | yield;
+LL | | });
+ | |_____^
+note: required by a bound in `assert_send`
+ --> $DIR/not-send-sync.rs:7:23
|
LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^ required by this bound in `assert_send`
-error[E0277]: `std::cell::Cell<i32>` cannot be shared between threads safely
- --> $DIR/not-send-sync.rs:19:5
+error: generator cannot be shared between threads safely
+ --> $DIR/not-send-sync.rs:9:5
|
LL | assert_sync(|| {
- | ^^^^^^^^^^^ `std::cell::Cell<i32>` cannot be shared between threads safely
+ | ^^^^^^^^^^^ generator is not `Sync`
|
- = help: within `[generator@$DIR/not-send-sync.rs:19:17: 23:6 {std::cell::Cell<i32>, ()}]`, the trait `std::marker::Sync` is not implemented for `std::cell::Cell<i32>`
- = note: required because it appears within the type `{std::cell::Cell<i32>, ()}`
- = note: required because it appears within the type `[generator@$DIR/not-send-sync.rs:19:17: 23:6 {std::cell::Cell<i32>, ()}]`
-note: required by `main::assert_sync`
- --> $DIR/not-send-sync.rs:16:5
+ = help: within `[generator@$DIR/not-send-sync.rs:9:17: 13:6]`, the trait `Sync` is not implemented for `Cell<i32>`
+note: generator is not `Sync` as this value is used across a yield
+ --> $DIR/not-send-sync.rs:12: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
+note: required by a bound in `assert_sync`
+ --> $DIR/not-send-sync.rs:6:23
|
LL | fn assert_sync<T: Sync>(_: T) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^ required by this bound in `assert_sync`
error: aborting due to 2 previous errors