rust/tests/ui/coroutine/coroutine-resume-after-panic.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
546 B
Rust
Raw Normal View History

2020-04-16 06:50:32 +00:00
//@ run-fail
//@ needs-unwind
2023-10-19 21:46:28 +00:00
//@ error-pattern:coroutine resumed after panicking
2020-05-07 15:39:02 +00:00
//@ ignore-emscripten no processes
2023-10-19 21:46:28 +00:00
// Test that we get the correct message for resuming a panicked coroutine.
#![feature(coroutines, coroutine_trait, stmt_expr_attributes)]
use std::{
2023-10-19 16:06:43 +00:00
ops::Coroutine,
pin::Pin,
panic,
};
fn main() {
let mut g = #[coroutine] || {
panic!();
yield;
};
panic::catch_unwind(panic::AssertUnwindSafe(|| {
let x = Pin::new(&mut g).resume(());
}));
Pin::new(&mut g).resume(());
}