fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
2.5 KiB61 linesraw
1error: generator cannot be sent between threads safely
2  --> $DIR/issue-68112.rs:40:5
3   |
4LL |     require_send(send_gen);
5   |     ^^^^^^^^^^^^ generator is not `Send`
6   |
7   = help: the trait `Sync` is not implemented for `RefCell<i32>`
8   = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
9note: generator is not `Send` as this value is used across a yield
10  --> $DIR/issue-68112.rs:36:9
11   |
12LL |         let _non_send_gen = make_non_send_generator();
13   |             ------------- has type `impl Generator<Return = Arc<RefCell<i32>>>` which is not `Send`
14LL |
15LL |         yield;
16   |         ^^^^^ yield occurs here, with `_non_send_gen` maybe used later
17note: required by a bound in `require_send`
18  --> $DIR/issue-68112.rs:22:25
19   |
20LL | fn require_send(_: impl Send) {}
21   |                         ^^^^ required by this bound in `require_send`
22
23error[E0277]: `RefCell<i32>` cannot be shared between threads safely
24  --> $DIR/issue-68112.rs:64:5
25   |
26LL |     require_send(send_gen);
27   |     ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
28   |
29   = help: the trait `Sync` is not implemented for `RefCell<i32>`
30   = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
31   = note: required for `Arc<RefCell<i32>>` to implement `Send`
32note: required because it's used within this generator
33  --> $DIR/issue-68112.rs:49:5
34   |
35LL |     || {
36   |     ^^
37note: required because it appears within the type `impl Generator<Return = Arc<RefCell<i32>>>`
38  --> $DIR/issue-68112.rs:46:30
39   |
40LL | pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> {
41   |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^
42note: required because it appears within the type `impl Generator<Return = Arc<RefCell<i32>>>`
43  --> $DIR/issue-68112.rs:54:34
44   |
45LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> {
46   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47   = note: required because it captures the following types: `impl Generator<Return = Arc<RefCell<i32>>>`
48note: required because it's used within this generator
49  --> $DIR/issue-68112.rs:60:20
50   |
51LL |     let send_gen = || {
52   |                    ^^
53note: required by a bound in `require_send`
54  --> $DIR/issue-68112.rs:22:25
55   |
56LL | fn require_send(_: impl Send) {}
57   |                         ^^^^ required by this bound in `require_send`
58
59error: aborting due to 2 previous errors
60
61For more information about this error, try `rustc --explain E0277`.