@@ -12,30 +12,43 @@ LL | let r = Rc::new(());
12
12
| - has type `Rc<()>` which is not `Send`
13
13
LL | bar().await
14
14
| ^^^^^ await occurs here, with `r` maybe used later
15
- LL | };
16
- | - `r` is later dropped here
17
15
note: required by a bound in `is_send`
18
16
--> $DIR/async-await-let-else.rs:16:15
19
17
|
20
18
LL | fn is_send<T: Send>(_: T) {}
21
19
| ^^^^ required by this bound in `is_send`
22
20
23
- error: future cannot be sent between threads safely
21
+ error[E0277]: `Rc<()>` cannot be sent between threads safely
24
22
--> $DIR/async-await-let-else.rs:47:13
25
23
|
24
+ LL | async fn foo2(x: Option<bool>) {
25
+ | - within this `impl Future<Output = ()>`
26
+ ...
26
27
LL | is_send(foo2(Some(true)));
27
- | ^^^^^^^^^^^^^^^^ future returned by `foo2` is not `Send`
28
+ | ------- ^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely
29
+ | |
30
+ | required by a bound introduced by this call
28
31
|
29
32
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
30
- note: future is not `Send` as this value is used across an await
31
- --> $DIR/async-await-let-else.rs:20:27
32
- |
33
- LL | bar2(Rc::new(())).await
34
- | ----------- ^^^^^ await occurs here, with `Rc::new(())` maybe used later
35
- | |
36
- | has type `Rc<()>` which is not `Send`
37
- LL | };
38
- | - `Rc::new(())` is later dropped here
33
+ note: required because it's used within this `async fn` body
34
+ --> $DIR/async-await-let-else.rs:24:29
35
+ |
36
+ LL | async fn bar2<T>(_: T) -> ! {
37
+ | _____________________________^
38
+ LL | | panic!()
39
+ LL | | }
40
+ | |_^
41
+ = note: required because it captures the following types: `impl Future<Output = !>`
42
+ note: required because it's used within this `async fn` body
43
+ --> $DIR/async-await-let-else.rs:18:32
44
+ |
45
+ LL | async fn foo2(x: Option<bool>) {
46
+ | ________________________________^
47
+ LL | | let Some(_) = x else {
48
+ LL | | bar2(Rc::new(())).await
49
+ LL | | };
50
+ LL | | }
51
+ | |_^
39
52
note: required by a bound in `is_send`
40
53
--> $DIR/async-await-let-else.rs:16:15
41
54
|
@@ -53,9 +66,8 @@ note: future is not `Send` as this value is used across an await
53
66
--> $DIR/async-await-let-else.rs:30:29
54
67
|
55
68
LL | (Rc::new(()), bar().await);
56
- | ----------- ^^^^^ - `Rc::new(())` is later dropped here
57
- | | |
58
- | | await occurs here, with `Rc::new(())` maybe used later
69
+ | ----------- ^^^^^ await occurs here, with `Rc::new(())` maybe used later
70
+ | |
59
71
| has type `Rc<()>` which is not `Send`
60
72
note: required by a bound in `is_send`
61
73
--> $DIR/async-await-let-else.rs:16:15
@@ -77,9 +89,6 @@ LL | let r = Rc::new(());
77
89
| - has type `Rc<()>` which is not `Send`
78
90
LL | bar().await;
79
91
| ^^^^^ await occurs here, with `r` maybe used later
80
- ...
81
- LL | };
82
- | - `r` is later dropped here
83
92
note: required by a bound in `is_send`
84
93
--> $DIR/async-await-let-else.rs:16:15
85
94
|
@@ -88,3 +97,4 @@ LL | fn is_send<T: Send>(_: T) {}
88
97
89
98
error: aborting due to 4 previous errors
90
99
100
+ For more information about this error, try `rustc --explain E0277`.
0 commit comments