fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #68568 - pietroalbini:stable-next, r=pietroalbini5e1a799842b

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