You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| ----------- ---- 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 cannot be sent between threads safely
12
+
note: future is not `Send` as this value is used across an await
13
+
--> $DIR/async-fn-nonsend.rs:25:5
14
+
|
15
+
LL | let x = non_send();
16
+
| - has type `impl std::fmt::Debug`
17
+
LL | drop(x);
18
+
LL | fut().await;
19
+
| ^^^^^^^^^^^ await occurs here, with `x` maybe used later
20
+
LL | }
21
+
| - `x` is later dropped here
17
22
18
23
error[E0277]: `std::rc::Rc<()>` cannot be sent between threads safely
| ----------- ---- required by this bound in `assert_send`
23
28
...
24
29
LL | assert_send(non_send_temporary_in_match());
25
-
| ^^^^^^^^^^^ `std::rc::Rc<()>` cannot be sent between threads safely
30
+
| ^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send`
26
31
|
27
32
= 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`
33
+
= note: future cannot be sent between threads safely
34
+
note: future is not `Send` as this value is used across an await
35
+
--> $DIR/async-fn-nonsend.rs:34:20
36
+
|
37
+
LL | match Some(non_send()) {
38
+
| ---------- has type `impl std::fmt::Debug`
39
+
LL | Some(_) => fut().await,
40
+
| ^^^^^^^^^^^ await occurs here, with `non_send()` maybe used later
41
+
...
42
+
LL | }
43
+
| - `non_send()` is later dropped here
34
44
35
45
error[E0277]: `dyn std::fmt::Write` cannot be sent between threads safely
| ----------- ---- required by this bound in `assert_send`
40
50
...
41
51
LL | assert_send(non_sync_with_method_call());
42
-
| ^^^^^^^^^^^ `dyn std::fmt::Write` cannot be sent between threads safely
52
+
| ^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send`
43
53
|
44
54
= 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`
55
+
= note: future cannot be sent between threads safely
56
+
note: future is not `Send` as this value is used across an await
57
+
--> $DIR/async-fn-nonsend.rs:43:9
58
+
|
59
+
LL | let f: &mut std::fmt::Formatter = panic!();
60
+
| - has type `&mut std::fmt::Formatter<'_>`
61
+
LL | if non_sync().fmt(f).unwrap() == () {
62
+
LL | fut().await;
63
+
| ^^^^^^^^^^^ await occurs here, with `f` maybe used later
64
+
LL | }
65
+
LL | }
66
+
| - `f` is later dropped here
53
67
54
68
error[E0277]: `*mut (dyn std::ops::Fn() + 'static)` cannot be shared between threads safely
| ----------- ---- required by this bound in `assert_send`
59
73
...
60
74
LL | assert_send(non_sync_with_method_call());
61
-
| ^^^^^^^^^^^ `*mut (dyn std::ops::Fn() + 'static)` cannot be shared between threads safely
75
+
| ^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send`
62
76
|
63
77
= 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`
78
+
= note: future cannot be sent between threads safely
79
+
note: future is not `Send` as this value is used across an await
80
+
--> $DIR/async-fn-nonsend.rs:43:9
81
+
|
82
+
LL | let f: &mut std::fmt::Formatter = panic!();
83
+
| - has type `&mut std::fmt::Formatter<'_>`
84
+
LL | if non_sync().fmt(f).unwrap() == () {
85
+
LL | fut().await;
86
+
| ^^^^^^^^^^^ await occurs here, with `f` maybe used later
| ------- ---- required by this bound in `is_sync`
6
6
...
7
7
LL | is_sync(bar());
8
-
| ^^^^^^^ `Foo` cannot be shared between threads safely
8
+
| ^^^^^^^ future returned by `bar` is not `Sync`
9
9
|
10
10
= help: within `impl std::future::Future`, the trait `std::marker::Sync` is not implemented for `Foo`
11
-
= note: required because it appears within the type `{Foo, impl std::future::Future, impl std::future::Future, ()}`
12
-
= note: required because it appears within the type `[static generator@$DIR/issue-64130-1-sync.rs:13:16: 16:2 {Foo, impl std::future::Future, impl std::future::Future, ()}]`
13
-
= note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/issue-64130-1-sync.rs:13:16: 16:2 {Foo, impl std::future::Future, impl std::future::Future, ()}]>`
14
-
= note: required because it appears within the type `impl std::future::Future`
15
-
= note: required because it appears within the type `impl std::future::Future`
11
+
= note: future cannot be shared between threads safely
12
+
note: future is not `Sync` as this value is used across an await
13
+
--> $DIR/issue-64130-1-sync.rs:15:5
14
+
|
15
+
LL | let x = Foo;
16
+
| - has type `Foo`
17
+
LL | baz().await;
18
+
| ^^^^^^^^^^^ await occurs here, with `x` maybe used later
| ------- ---- required by this bound in `is_send`
6
6
...
7
7
LL | is_send(bar());
8
-
| ^^^^^^^ `Foo` cannot be sent between threads safely
8
+
| ^^^^^^^ future returned by `bar` is not `Send`
9
9
|
10
10
= help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `Foo`
11
-
= note: required because it appears within the type `{Foo, impl std::future::Future, impl std::future::Future, ()}`
12
-
= note: required because it appears within the type `[static generator@$DIR/issue-64130-2-send.rs:13:16: 16:2 {Foo, impl std::future::Future, impl std::future::Future, ()}]`
13
-
= note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/issue-64130-2-send.rs:13:16: 16:2 {Foo, impl std::future::Future, impl std::future::Future, ()}]>`
14
-
= note: required because it appears within the type `impl std::future::Future`
15
-
= note: required because it appears within the type `impl std::future::Future`
11
+
= note: future cannot be sent between threads safely
12
+
note: future is not `Send` as this value is used across an await
13
+
--> $DIR/issue-64130-2-send.rs:15:5
14
+
|
15
+
LL | let x = Foo;
16
+
| - has type `Foo`
17
+
LL | baz().await;
18
+
| ^^^^^^^^^^^ await occurs here, with `x` maybe used later
Copy file name to clipboardExpand all lines: src/test/ui/async-await/issue-64130-3-other.stderr
+9-5
Original file line number
Diff line number
Diff line change
@@ -9,11 +9,15 @@ LL | is_qux(bar());
9
9
|
10
10
= help: the following implementations were found:
11
11
<Foo as Qux>
12
-
= note: required because it appears within the type `{Foo, impl std::future::Future, impl std::future::Future, ()}`
13
-
= note: required because it appears within the type `[static generator@$DIR/issue-64130-3-other.rs:15:16: 18:2 {Foo, impl std::future::Future, impl std::future::Future, ()}]`
14
-
= note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/issue-64130-3-other.rs:15:16: 18:2 {Foo, 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`
12
+
note: future does not implement `Qux` as this value is used across an await
13
+
--> $DIR/issue-64130-3-other.rs:17:5
14
+
|
15
+
LL | let x = Foo;
16
+
| - has type `Foo`
17
+
LL | baz().await;
18
+
| ^^^^^^^^^^^ await occurs here, with `x` maybe used later
| ^^^^^^^^^^^^^^^^^^ `(dyn std::any::Any + std::marker::Send + 'static)` cannot be shared between threads safely
5
+
| ^^^^^^^^^^^^^^^^^^ future returned by `foo` is not `Send`
6
6
|
7
7
= help: the trait `std::marker::Sync` is not implemented for `(dyn std::any::Any + std::marker::Send + 'static)`
8
-
= note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<(dyn std::any::Any + std::marker::Send + 'static)>`
9
-
= note: required because it appears within the type `std::boxed::Box<(dyn std::any::Any + std::marker::Send + 'static)>`
10
-
= note: required because it appears within the type `Client`
11
-
= note: required because of the requirements on the impl of `std::marker::Send` for `&Client`
12
-
= note: required because it appears within the type `for<'r> {&'r Client, Client, u16, u16, impl std::future::Future, impl std::future::Future, ()}`
13
-
= note: required because it appears within the type `[static generator@$DIR/issue-64130-4-async-move.rs:18:16: 25:6 client:Client for<'r> {&'r Client, Client, u16, u16, impl std::future::Future, impl std::future::Future, ()}]`
14
-
= note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/issue-64130-4-async-move.rs:18:16: 25:6 client:Client for<'r> {&'r Client, Client, u16, u16, impl std::future::Future, impl std::future::Future, ()}]>`
15
-
= note: required because it appears within the type `impl std::future::Future`
8
+
= note: future cannot be sent between threads safely
9
+
note: future is not `Send` as this value is used across an await
10
+
--> $DIR/issue-64130-4-async-move.rs:21:26
11
+
|
12
+
LL | match client.status() {
13
+
| ------ has type `&Client`
14
+
LL | 200 => {
15
+
LL | let _x = get().await;
16
+
| ^^^^^^^^^^^ await occurs here, with `client` maybe used later
17
+
...
18
+
LL | }
19
+
| - `client` is later dropped here
16
20
= note: the return type of a function must have a statically known size
| ------- ---- required by this bound in `is_send`
6
6
...
7
7
LL | is_send(foo());
8
-
| ^^^^^^^ `std::sync::MutexGuard<'_, u32>` cannot be sent between threads safely
8
+
| ^^^^^^^ future returned by `foo` is not `Send`
9
9
|
10
10
= help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `std::sync::MutexGuard<'_, u32>`
11
-
= note: required because it appears within the type `for<'r, 's> {&'r std::sync::Mutex<u32>, std::sync::MutexGuard<'s, u32>, impl std::future::Future, impl std::future::Future, ()}`
12
-
= note: required because it appears within the type `[static generator@$DIR/issue-64130-non-send-future-diags.rs:13:30: 16:2 x:&std::sync::Mutex<u32> for<'r, 's> {&'r std::sync::Mutex<u32>, std::sync::MutexGuard<'s, u32>, impl std::future::Future, impl std::future::Future, ()}]`
13
-
= note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/issue-64130-non-send-future-diags.rs:13:30: 16:2 x:&std::sync::Mutex<u32> for<'r, 's> {&'r std::sync::Mutex<u32>, std::sync::MutexGuard<'s, u32>, impl std::future::Future, impl std::future::Future, ()}]>`
14
-
= note: required because it appears within the type `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 `for<'r, 's, 't0, 't1> {u32, std::sync::Mutex<u32>, &'r std::sync::Mutex<u32>, &'s std::sync::Mutex<u32>, impl std::future::Future, impl std::future::Future, ()}`
17
-
= note: required because it appears within the type `[static generator@$DIR/issue-64130-non-send-future-diags.rs:9:16: 11:2 for<'r, 's, 't0, 't1> {u32, std::sync::Mutex<u32>, &'r std::sync::Mutex<u32>, &'s std::sync::Mutex<u32>, impl std::future::Future, impl std::future::Future, ()}]`
18
-
= note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/issue-64130-non-send-future-diags.rs:9:16: 11:2 for<'r, 's, 't0, 't1> {u32, std::sync::Mutex<u32>, &'r std::sync::Mutex<u32>, &'s std::sync::Mutex<u32>, impl std::future::Future, impl std::future::Future, ()}]>`
19
-
= note: required because it appears within the type `impl std::future::Future`
20
-
= note: required because it appears within the type `impl std::future::Future`
11
+
= note: future cannot be sent between threads safely
12
+
note: future is not `Send` as this value is used across an await
| ----------- ---- required by this bound in `main::assert_sync`
19
19
...
20
20
LL | assert_sync(|| {
21
-
| ^^^^^^^^^^^ `std::cell::Cell<i32>` cannot be shared between threads safely
21
+
| ^^^^^^^^^^^ future returned by `main` is not `Sync`
22
22
|
23
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>`
24
-
= note: required because it appears within the type `{std::cell::Cell<i32>, ()}`
25
-
= note: required because it appears within the type `[generator@$DIR/not-send-sync.rs:9:17: 13:6 {std::cell::Cell<i32>, ()}]`
24
+
= note: future cannot be shared between threads safely
25
+
note: future is not `Sync` as this value is used across an yield
26
+
--> $DIR/not-send-sync.rs:12:9
27
+
|
28
+
LL | let a = Cell::new(2);
29
+
| - has type `std::cell::Cell<i32>`
30
+
LL | yield;
31
+
| ^^^^^ yield occurs here, with `a` maybe used later
0 commit comments