|
| 1 | +error[E0277]: the type `&mut Context<'_>` may not be safely transferred across an unwind boundary |
| 2 | + --> $DIR/async-is-unwindsafe.rs:12:19 |
| 3 | + | |
| 4 | +LL | is_unwindsafe(async { |
| 5 | + | ___________________^ |
| 6 | +LL | | |
| 7 | +LL | | use std::ptr::null; |
| 8 | +LL | | use std::task::{Context, RawWaker, RawWakerVTable, Waker}; |
| 9 | +... | |
| 10 | +LL | | drop(cx_ref); |
| 11 | +LL | | }); |
| 12 | + | | ^ |
| 13 | + | | | |
| 14 | + | |_____`&mut Context<'_>` may not be safely transferred across an unwind boundary |
| 15 | + | within this `[async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6]` |
| 16 | + | |
| 17 | + = help: within `[async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6]`, the trait `UnwindSafe` is not implemented for `&mut Context<'_>` |
| 18 | + = note: `UnwindSafe` is implemented for `&std::task::Context<'_>`, but not for `&mut std::task::Context<'_>` |
| 19 | +note: future does not implement `UnwindSafe` as this value is used across an await |
| 20 | + --> $DIR/async-is-unwindsafe.rs:25:17 |
| 21 | + | |
| 22 | +LL | let cx_ref = &mut cx; |
| 23 | + | ------ has type `&mut Context<'_>` which does not implement `UnwindSafe` |
| 24 | +LL | |
| 25 | +LL | async {}.await; // this needs an inner await point |
| 26 | + | ^^^^^^ await occurs here, with `cx_ref` maybe used later |
| 27 | +... |
| 28 | +LL | }); |
| 29 | + | - `cx_ref` is later dropped here |
| 30 | +note: required by a bound in `is_unwindsafe` |
| 31 | + --> $DIR/async-is-unwindsafe.rs:3:26 |
| 32 | + | |
| 33 | +LL | fn is_unwindsafe(_: impl std::panic::UnwindSafe) {} |
| 34 | + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_unwindsafe` |
| 35 | + |
| 36 | +error: aborting due to previous error |
| 37 | + |
| 38 | +For more information about this error, try `rustc --explain E0277`. |
0 commit comments