Skip to content

Commit 4f82731

Browse files
committed
update tests
1 parent 13838a5 commit 4f82731

File tree

2 files changed

+38
-6
lines changed

2 files changed

+38
-6
lines changed

tests/ui/async-await/async-is-unwindsafe.rs

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ fn main() {
1111

1212
is_unwindsafe(async {
1313
//~^ ERROR the type `&mut Context<'_>` may not be safely transferred across an unwind boundary
14+
//~| ERROR the type `&mut (dyn Any + 'static)` may not be safely transferred across an unwind boundary
1415
use std::ptr::null;
1516
use std::task::{Context, RawWaker, RawWakerVTable, Waker};
1617
let waker = unsafe {

tests/ui/async-await/async-is-unwindsafe.stderr

+37-6
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,18 @@ LL | is_unwindsafe(async {
66
| |_____|
77
| ||
88
LL | ||
9+
LL | ||
910
LL | || use std::ptr::null;
10-
LL | || use std::task::{Context, RawWaker, RawWakerVTable, Waker};
1111
... ||
1212
LL | || drop(cx_ref);
1313
LL | || });
1414
| ||_____-^ `&mut Context<'_>` may not be safely transferred across an unwind boundary
1515
| |_____|
16-
| within this `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}`
16+
| within this `{async block@$DIR/async-is-unwindsafe.rs:12:19: 30:6}`
1717
|
18-
= help: within `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}`, the trait `UnwindSafe` is not implemented for `&mut Context<'_>`, which is required by `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}: UnwindSafe`
19-
= note: `UnwindSafe` is implemented for `&Context<'_>`, but not for `&mut Context<'_>`
18+
= help: within `{async block@$DIR/async-is-unwindsafe.rs:12:19: 30:6}`, the trait `UnwindSafe` is not implemented for `&mut Context<'_>`, which is required by `{async block@$DIR/async-is-unwindsafe.rs:12:19: 30:6}: UnwindSafe`
2019
note: future does not implement `UnwindSafe` as this value is used across an await
21-
--> $DIR/async-is-unwindsafe.rs:25:18
20+
--> $DIR/async-is-unwindsafe.rs:26:18
2221
|
2322
LL | let cx_ref = &mut cx;
2423
| ------ has type `&mut Context<'_>` which does not implement `UnwindSafe`
@@ -31,6 +30,38 @@ note: required by a bound in `is_unwindsafe`
3130
LL | fn is_unwindsafe(_: impl std::panic::UnwindSafe) {}
3231
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_unwindsafe`
3332

34-
error: aborting due to 1 previous error
33+
error[E0277]: the type `&mut (dyn Any + 'static)` may not be safely transferred across an unwind boundary
34+
--> $DIR/async-is-unwindsafe.rs:12:5
35+
|
36+
LL | is_unwindsafe(async {
37+
| _____^_____________-
38+
| |_____|
39+
| ||
40+
LL | ||
41+
LL | ||
42+
LL | || use std::ptr::null;
43+
... ||
44+
LL | || drop(cx_ref);
45+
LL | || });
46+
| ||_____-^ `&mut (dyn Any + 'static)` may not be safely transferred across an unwind boundary
47+
| |_____|
48+
| within this `{async block@$DIR/async-is-unwindsafe.rs:12:19: 30:6}`
49+
|
50+
= help: within `{async block@$DIR/async-is-unwindsafe.rs:12:19: 30:6}`, the trait `UnwindSafe` is not implemented for `&mut (dyn Any + 'static)`, which is required by `{async block@$DIR/async-is-unwindsafe.rs:12:19: 30:6}: UnwindSafe`
51+
note: future does not implement `UnwindSafe` as this value is used across an await
52+
--> $DIR/async-is-unwindsafe.rs:26:18
53+
|
54+
LL | let mut cx = Context::from_waker(&waker);
55+
| ------ has type `Context<'_>` which does not implement `UnwindSafe`
56+
...
57+
LL | async {}.await; // this needs an inner await point
58+
| ^^^^^ await occurs here, with `mut cx` maybe used later
59+
note: required by a bound in `is_unwindsafe`
60+
--> $DIR/async-is-unwindsafe.rs:3:26
61+
|
62+
LL | fn is_unwindsafe(_: impl std::panic::UnwindSafe) {}
63+
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_unwindsafe`
64+
65+
error: aborting due to 2 previous errors
3566

3667
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)