]> git.lizzy.rs Git - rust.git/blob - tests/ui/generator/not-send-sync.stderr
Rollup merge of #106638 - RalfJung:realstd, r=thomcc
[rust.git] / tests / ui / generator / not-send-sync.stderr
1 error[E0277]: `Cell<i32>` cannot be shared between threads safely
2   --> $DIR/not-send-sync.rs:16:17
3    |
4 LL |       assert_send(|| {
5    |  _____-----------_^
6    | |     |
7    | |     required by a bound introduced by this call
8 LL | |
9 LL | |         drop(&a);
10 LL | |         yield;
11 LL | |     });
12    | |_____^ `Cell<i32>` cannot be shared between threads safely
13    |
14    = help: the trait `Sync` is not implemented for `Cell<i32>`
15    = note: required for `&Cell<i32>` to implement `Send`
16 note: required because it's used within this generator
17   --> $DIR/not-send-sync.rs:16:17
18    |
19 LL |     assert_send(|| {
20    |                 ^^
21 note: required by a bound in `assert_send`
22   --> $DIR/not-send-sync.rs:7:23
23    |
24 LL |     fn assert_send<T: Send>(_: T) {}
25    |                       ^^^^ required by this bound in `assert_send`
26
27 error: generator cannot be shared between threads safely
28   --> $DIR/not-send-sync.rs:9:17
29    |
30 LL |       assert_sync(|| {
31    |  _________________^
32 LL | |
33 LL | |         let a = Cell::new(2);
34 LL | |         yield;
35 LL | |     });
36    | |_____^ generator is not `Sync`
37    |
38    = help: within `[generator@$DIR/not-send-sync.rs:9:17: 9:19]`, the trait `Sync` is not implemented for `Cell<i32>`
39 note: generator is not `Sync` as this value is used across a yield
40   --> $DIR/not-send-sync.rs:12:9
41    |
42 LL |         let a = Cell::new(2);
43    |             - has type `Cell<i32>` which is not `Sync`
44 LL |         yield;
45    |         ^^^^^ yield occurs here, with `a` maybe used later
46 LL |     });
47    |     - `a` is later dropped here
48 note: required by a bound in `assert_sync`
49   --> $DIR/not-send-sync.rs:6:23
50    |
51 LL |     fn assert_sync<T: Sync>(_: T) {}
52    |                       ^^^^ required by this bound in `assert_sync`
53
54 error: aborting due to 2 previous errors
55
56 For more information about this error, try `rustc --explain E0277`.