|
1 | | -error[E0277]: `std::rc::Rc<()>` cannot be sent between threads safely |
| 1 | +error: future cannot be sent between threads safely |
2 | 2 | --> $DIR/async-fn-nonsend.rs:50:5 |
3 | 3 | | |
4 | 4 | LL | fn assert_send(_: impl Send) {} |
5 | 5 | | ----------- ---- required by this bound in `assert_send` |
6 | 6 | ... |
7 | 7 | LL | assert_send(local_dropped_before_await()); |
8 | | - | ^^^^^^^^^^^ `std::rc::Rc<()>` cannot be sent between threads safely |
| 8 | + | ^^^^^^^^^^^ future returned by `local_dropped_before_await` is not `Send` |
9 | 9 | | |
10 | 10 | = help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<()>` |
11 | | - = note: required because it appears within the type `impl std::fmt::Debug` |
12 | | - = note: required because it appears within the type `{impl std::fmt::Debug, impl std::future::Future, impl std::future::Future, ()}` |
13 | | - = note: required because it appears within the type `[static generator@$DIR/async-fn-nonsend.rs:21:39: 26:2 {impl std::fmt::Debug, impl std::future::Future, impl std::future::Future, ()}]` |
14 | | - = note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/async-fn-nonsend.rs:21:39: 26:2 {impl std::fmt::Debug, impl std::future::Future, impl std::future::Future, ()}]>` |
15 | | - = note: required because it appears within the type `impl std::future::Future` |
16 | | - = note: required because it appears within the type `impl std::future::Future` |
| 11 | +note: future is not `Send` as this value is used across an await |
| 12 | + --> $DIR/async-fn-nonsend.rs:25:5 |
| 13 | + | |
| 14 | +LL | let x = non_send(); |
| 15 | + | - has type `impl std::fmt::Debug` |
| 16 | +LL | drop(x); |
| 17 | +LL | fut().await; |
| 18 | + | ^^^^^^^^^^^ await occurs here, with `x` maybe used later |
| 19 | +LL | } |
| 20 | + | - `x` is later dropped here |
17 | 21 |
|
18 | | -error[E0277]: `std::rc::Rc<()>` cannot be sent between threads safely |
| 22 | +error: future cannot be sent between threads safely |
19 | 23 | --> $DIR/async-fn-nonsend.rs:52:5 |
20 | 24 | | |
21 | 25 | LL | fn assert_send(_: impl Send) {} |
22 | 26 | | ----------- ---- required by this bound in `assert_send` |
23 | 27 | ... |
24 | 28 | LL | assert_send(non_send_temporary_in_match()); |
25 | | - | ^^^^^^^^^^^ `std::rc::Rc<()>` cannot be sent between threads safely |
| 29 | + | ^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send` |
26 | 30 | | |
27 | 31 | = help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<()>` |
28 | | - = note: required because it appears within the type `impl std::fmt::Debug` |
29 | | - = note: required because it appears within the type `{impl std::fmt::Debug, std::option::Option<impl std::fmt::Debug>, impl std::future::Future, impl std::future::Future, ()}` |
30 | | - = note: required because it appears within the type `[static generator@$DIR/async-fn-nonsend.rs:28:40: 37:2 {impl std::fmt::Debug, std::option::Option<impl std::fmt::Debug>, impl std::future::Future, impl std::future::Future, ()}]` |
31 | | - = note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/async-fn-nonsend.rs:28:40: 37:2 {impl std::fmt::Debug, std::option::Option<impl std::fmt::Debug>, impl std::future::Future, impl std::future::Future, ()}]>` |
32 | | - = note: required because it appears within the type `impl std::future::Future` |
33 | | - = note: required because it appears within the type `impl std::future::Future` |
| 32 | +note: future is not `Send` as this value is used across an await |
| 33 | + --> $DIR/async-fn-nonsend.rs:34:20 |
| 34 | + | |
| 35 | +LL | match Some(non_send()) { |
| 36 | + | ---------- has type `impl std::fmt::Debug` |
| 37 | +LL | Some(_) => fut().await, |
| 38 | + | ^^^^^^^^^^^ await occurs here, with `non_send()` maybe used later |
| 39 | +... |
| 40 | +LL | } |
| 41 | + | - `non_send()` is later dropped here |
34 | 42 |
|
35 | | -error[E0277]: `dyn std::fmt::Write` cannot be sent between threads safely |
| 43 | +error: future cannot be sent between threads safely |
36 | 44 | --> $DIR/async-fn-nonsend.rs:54:5 |
37 | 45 | | |
38 | 46 | LL | fn assert_send(_: impl Send) {} |
39 | 47 | | ----------- ---- required by this bound in `assert_send` |
40 | 48 | ... |
41 | 49 | LL | assert_send(non_sync_with_method_call()); |
42 | | - | ^^^^^^^^^^^ `dyn std::fmt::Write` cannot be sent between threads safely |
| 50 | + | ^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send` |
43 | 51 | | |
44 | 52 | = help: the trait `std::marker::Send` is not implemented for `dyn std::fmt::Write` |
45 | | - = note: required because of the requirements on the impl of `std::marker::Send` for `&mut dyn std::fmt::Write` |
46 | | - = note: required because it appears within the type `std::fmt::Formatter<'_>` |
47 | | - = note: required because of the requirements on the impl of `std::marker::Send` for `&mut std::fmt::Formatter<'_>` |
48 | | - = note: required because it appears within the type `for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, bool, impl std::future::Future, impl std::future::Future, ()}` |
49 | | - = note: required because it appears within the type `[static generator@$DIR/async-fn-nonsend.rs:39:38: 45:2 for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, bool, impl std::future::Future, impl std::future::Future, ()}]` |
50 | | - = note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/async-fn-nonsend.rs:39:38: 45:2 for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, bool, impl std::future::Future, impl std::future::Future, ()}]>` |
51 | | - = note: required because it appears within the type `impl std::future::Future` |
52 | | - = note: required because it appears within the type `impl std::future::Future` |
| 53 | +note: future is not `Send` as this value is used across an await |
| 54 | + --> $DIR/async-fn-nonsend.rs:43:9 |
| 55 | + | |
| 56 | +LL | let f: &mut std::fmt::Formatter = panic!(); |
| 57 | + | - has type `&mut std::fmt::Formatter<'_>` |
| 58 | +LL | if non_sync().fmt(f).unwrap() == () { |
| 59 | +LL | fut().await; |
| 60 | + | ^^^^^^^^^^^ await occurs here, with `f` maybe used later |
| 61 | +LL | } |
| 62 | +LL | } |
| 63 | + | - `f` is later dropped here |
53 | 64 |
|
54 | | -error[E0277]: `*mut (dyn std::ops::Fn() + 'static)` cannot be shared between threads safely |
| 65 | +error: future cannot be sent between threads safely |
55 | 66 | --> $DIR/async-fn-nonsend.rs:54:5 |
56 | 67 | | |
57 | 68 | LL | fn assert_send(_: impl Send) {} |
58 | 69 | | ----------- ---- required by this bound in `assert_send` |
59 | 70 | ... |
60 | 71 | LL | assert_send(non_sync_with_method_call()); |
61 | | - | ^^^^^^^^^^^ `*mut (dyn std::ops::Fn() + 'static)` cannot be shared between threads safely |
| 72 | + | ^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send` |
62 | 73 | | |
63 | 74 | = help: within `std::fmt::ArgumentV1<'_>`, the trait `std::marker::Sync` is not implemented for `*mut (dyn std::ops::Fn() + 'static)` |
64 | | - = note: required because it appears within the type `std::marker::PhantomData<*mut (dyn std::ops::Fn() + 'static)>` |
65 | | - = note: required because it appears within the type `core::fmt::Void` |
66 | | - = note: required because it appears within the type `&core::fmt::Void` |
67 | | - = note: required because it appears within the type `std::fmt::ArgumentV1<'_>` |
68 | | - = note: required because of the requirements on the impl of `std::marker::Send` for `std::slice::Iter<'_, std::fmt::ArgumentV1<'_>>` |
69 | | - = note: required because it appears within the type `std::fmt::Formatter<'_>` |
70 | | - = note: required because of the requirements on the impl of `std::marker::Send` for `&mut std::fmt::Formatter<'_>` |
71 | | - = note: required because it appears within the type `for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, bool, impl std::future::Future, impl std::future::Future, ()}` |
72 | | - = note: required because it appears within the type `[static generator@$DIR/async-fn-nonsend.rs:39:38: 45:2 for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, bool, impl std::future::Future, impl std::future::Future, ()}]` |
73 | | - = note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/async-fn-nonsend.rs:39:38: 45:2 for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, bool, impl std::future::Future, impl std::future::Future, ()}]>` |
74 | | - = note: required because it appears within the type `impl std::future::Future` |
75 | | - = note: required because it appears within the type `impl std::future::Future` |
| 75 | +note: future is not `Send` as this value is used across an await |
| 76 | + --> $DIR/async-fn-nonsend.rs:43:9 |
| 77 | + | |
| 78 | +LL | let f: &mut std::fmt::Formatter = panic!(); |
| 79 | + | - has type `&mut std::fmt::Formatter<'_>` |
| 80 | +LL | if non_sync().fmt(f).unwrap() == () { |
| 81 | +LL | fut().await; |
| 82 | + | ^^^^^^^^^^^ await occurs here, with `f` maybe used later |
| 83 | +LL | } |
| 84 | +LL | } |
| 85 | + | - `f` is later dropped here |
76 | 86 |
|
77 | 87 | error: aborting due to 4 previous errors |
78 | 88 |
|
79 | | -For more information about this error, try `rustc --explain E0277`. |
|
0 commit comments