]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generator/not-send-sync.stderr
pretty.rs: Update Closure and Generator print
[rust.git] / src / test / ui / generator / not-send-sync.stderr
1 error[E0277]: `Cell<i32>` cannot be shared between threads safely
2   --> $DIR/not-send-sync.rs:16:5
3    |
4 LL |     fn assert_send<T: Send>(_: T) {}
5    |                       ---- required by this bound in `assert_send`
6 ...
7 LL |     assert_send(|| {
8    |     ^^^^^^^^^^^ `Cell<i32>` cannot be shared between threads safely
9    |
10    = help: the trait `Sync` is not implemented for `Cell<i32>`
11    = note: required because of the requirements on the impl of `Send` for `&Cell<i32>`
12    = note: required because it appears within the type `[generator@$DIR/not-send-sync.rs:16:17: 20:6 _]`
13
14 error: generator cannot be shared between threads safely
15   --> $DIR/not-send-sync.rs:9:5
16    |
17 LL |     fn assert_sync<T: Sync>(_: T) {}
18    |                       ---- required by this bound in `assert_sync`
19 ...
20 LL |     assert_sync(|| {
21    |     ^^^^^^^^^^^ generator is not `Sync`
22    |
23    = help: within `[generator@$DIR/not-send-sync.rs:9:17: 13:6 {Cell<i32>, ()}]`, the trait `Sync` is not implemented for `Cell<i32>`
24 note: generator is not `Sync` as this value is used across a yield
25   --> $DIR/not-send-sync.rs:12:9
26    |
27 LL |         let a = Cell::new(2);
28    |             - has type `Cell<i32>` which is not `Sync`
29 LL |         yield;
30    |         ^^^^^ yield occurs here, with `a` maybe used later
31 LL |     });
32    |     - `a` is later dropped here
33
34 error: aborting due to 2 previous errors
35
36 For more information about this error, try `rustc --explain E0277`.