Skip to content

Commit 5114cf3

Browse files
committed
Update issue-68114.rs
1 parent 777db10 commit 5114cf3

File tree

3 files changed

+103
-16
lines changed

3 files changed

+103
-16
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
error: future cannot be sent between threads safely
2+
--> $DIR/issue-68112.rs:37:18
3+
|
4+
LL | require_send(send_fut);
5+
| ^^^^^^^^ future created by async block is not `Send`
6+
|
7+
= help: the trait `Sync` is not implemented for `RefCell<i32>`
8+
note: future is not `Send` as it awaits another future which is not `Send`
9+
--> $DIR/issue-68112.rs:34:17
10+
|
11+
LL | let _ = non_send_fut.await;
12+
| ^^^^^^^^^^^^ await occurs here on type `impl Future<Output = Arc<RefCell<i32>>>`, which is not `Send`
13+
note: required by a bound in `require_send`
14+
--> $DIR/issue-68112.rs:14:25
15+
|
16+
LL | fn require_send(_: impl Send) {}
17+
| ^^^^ required by this bound in `require_send`
18+
19+
error: future cannot be sent between threads safely
20+
--> $DIR/issue-68112.rs:46:18
21+
|
22+
LL | require_send(send_fut);
23+
| ^^^^^^^^ future created by async block is not `Send`
24+
|
25+
= help: the trait `Sync` is not implemented for `RefCell<i32>`
26+
note: future is not `Send` as it awaits another future which is not `Send`
27+
--> $DIR/issue-68112.rs:43:17
28+
|
29+
LL | let _ = make_non_send_future1().await;
30+
| ^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `impl Future<Output = Arc<RefCell<i32>>>`, which is not `Send`
31+
note: required by a bound in `require_send`
32+
--> $DIR/issue-68112.rs:14:25
33+
|
34+
LL | fn require_send(_: impl Send) {}
35+
| ^^^^ required by this bound in `require_send`
36+
37+
error[E0277]: `RefCell<i32>` cannot be shared between threads safely
38+
--> $DIR/issue-68112.rs:65:18
39+
|
40+
LL | require_send(send_fut);
41+
| ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
42+
| |
43+
| required by a bound introduced by this call
44+
|
45+
= help: the trait `Sync` is not implemented for `RefCell<i32>`
46+
= note: required for `Arc<RefCell<i32>>` to implement `Send`
47+
note: required because it's used within this `async fn` body
48+
--> $DIR/issue-68112.rs:50:31
49+
|
50+
LL | async fn ready2<T>(t: T) -> T {
51+
| _______________________________^
52+
LL | | t
53+
LL | | }
54+
| |_^
55+
note: required because it appears within the type `impl Future<Output = Arc<RefCell<i32>>>`
56+
--> $DIR/issue-68112.rs:53:31
57+
|
58+
LL | fn make_non_send_future2() -> impl Future<Output = Arc<RefCell<i32>>> {
59+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
60+
= note: required because it captures the following types: `ResumeTy`, `impl Future<Output = Arc<RefCell<i32>>>`, `()`, `Ready<i32>`
61+
note: required because it's used within this `async` block
62+
--> $DIR/issue-68112.rs:60:26
63+
|
64+
LL | let send_fut = async {
65+
| __________________________^
66+
LL | | let non_send_fut = make_non_send_future2();
67+
LL | | let _ = non_send_fut.await;
68+
LL | | ready(0).await;
69+
LL | | };
70+
| |_____^
71+
note: required by a bound in `require_send`
72+
--> $DIR/issue-68112.rs:14:25
73+
|
74+
LL | fn require_send(_: impl Send) {}
75+
| ^^^^ required by this bound in `require_send`
76+
77+
error: aborting due to 3 previous errors
78+
79+
For more information about this error, try `rustc --explain E0277`.

src/test/ui/async-await/issue-68112.stderr renamed to src/test/ui/async-await/issue-68112.no_drop_tracking.stderr

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
error: future cannot be sent between threads safely
2-
--> $DIR/issue-68112.rs:34:18
2+
--> $DIR/issue-68112.rs:37:18
33
|
44
LL | require_send(send_fut);
55
| ^^^^^^^^ future created by async block is not `Send`
66
|
77
= help: the trait `Sync` is not implemented for `RefCell<i32>`
88
note: future is not `Send` as it awaits another future which is not `Send`
9-
--> $DIR/issue-68112.rs:31:17
9+
--> $DIR/issue-68112.rs:34:17
1010
|
1111
LL | let _ = non_send_fut.await;
1212
| ^^^^^^^^^^^^ await occurs here on type `impl Future<Output = Arc<RefCell<i32>>>`, which is not `Send`
1313
note: required by a bound in `require_send`
14-
--> $DIR/issue-68112.rs:11:25
14+
--> $DIR/issue-68112.rs:14:25
1515
|
1616
LL | fn require_send(_: impl Send) {}
1717
| ^^^^ required by this bound in `require_send`
1818

1919
error: future cannot be sent between threads safely
20-
--> $DIR/issue-68112.rs:43:18
20+
--> $DIR/issue-68112.rs:46:18
2121
|
2222
LL | require_send(send_fut);
2323
| ^^^^^^^^ future created by async block is not `Send`
2424
|
2525
= help: the trait `Sync` is not implemented for `RefCell<i32>`
2626
note: future is not `Send` as it awaits another future which is not `Send`
27-
--> $DIR/issue-68112.rs:40:17
27+
--> $DIR/issue-68112.rs:43:17
2828
|
2929
LL | let _ = make_non_send_future1().await;
3030
| ^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `impl Future<Output = Arc<RefCell<i32>>>`, which is not `Send`
3131
note: required by a bound in `require_send`
32-
--> $DIR/issue-68112.rs:11:25
32+
--> $DIR/issue-68112.rs:14:25
3333
|
3434
LL | fn require_send(_: impl Send) {}
3535
| ^^^^ required by this bound in `require_send`
3636

3737
error[E0277]: `RefCell<i32>` cannot be shared between threads safely
38-
--> $DIR/issue-68112.rs:60:18
38+
--> $DIR/issue-68112.rs:65:18
3939
|
4040
LL | require_send(send_fut);
4141
| ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
@@ -45,18 +45,21 @@ LL | require_send(send_fut);
4545
= help: the trait `Sync` is not implemented for `RefCell<i32>`
4646
= note: required for `Arc<RefCell<i32>>` to implement `Send`
4747
note: required because it's used within this `async fn` body
48-
--> $DIR/issue-68112.rs:47:31
48+
--> $DIR/issue-68112.rs:50:31
4949
|
50-
LL | async fn ready2<T>(t: T) -> T { t }
51-
| ^^^^^
50+
LL | async fn ready2<T>(t: T) -> T {
51+
| _______________________________^
52+
LL | | t
53+
LL | | }
54+
| |_^
5255
note: required because it appears within the type `impl Future<Output = Arc<RefCell<i32>>>`
53-
--> $DIR/issue-68112.rs:48:31
56+
--> $DIR/issue-68112.rs:53:31
5457
|
5558
LL | fn make_non_send_future2() -> impl Future<Output = Arc<RefCell<i32>>> {
5659
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5760
= note: required because it captures the following types: `ResumeTy`, `impl Future<Output = Arc<RefCell<i32>>>`, `()`, `i32`, `Ready<i32>`
5861
note: required because it's used within this `async` block
59-
--> $DIR/issue-68112.rs:55:26
62+
--> $DIR/issue-68112.rs:60:26
6063
|
6164
LL | let send_fut = async {
6265
| __________________________^
@@ -66,7 +69,7 @@ LL | | ready(0).await;
6669
LL | | };
6770
| |_____^
6871
note: required by a bound in `require_send`
69-
--> $DIR/issue-68112.rs:11:25
72+
--> $DIR/issue-68112.rs:14:25
7073
|
7174
LL | fn require_send(_: impl Send) {}
7275
| ^^^^ required by this bound in `require_send`

src/test/ui/async-await/issue-68112.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
// edition:2018
2+
// revisions: no_drop_tracking drop_tracking
3+
// [drop_tracking] compile-flags: -Zdrop-tracking=yes
4+
// [no_drop_tracking] compile-flags: -Zdrop-tracking=no
25

36
use std::{
4-
future::Future,
57
cell::RefCell,
6-
sync::Arc,
8+
future::Future,
79
pin::Pin,
10+
sync::Arc,
811
task::{Context, Poll},
912
};
1013

@@ -44,7 +47,9 @@ fn test1_no_let() {
4447
//~^ ERROR future cannot be sent between threads
4548
}
4649

47-
async fn ready2<T>(t: T) -> T { t }
50+
async fn ready2<T>(t: T) -> T {
51+
t
52+
}
4853
fn make_non_send_future2() -> impl Future<Output = Arc<RefCell<i32>>> {
4954
ready2(Arc::new(RefCell::new(0)))
5055
}

0 commit comments

Comments
 (0)