2020-04-16 06:50:32 +00:00
|
|
|
//@ run-fail
|
2021-12-03 15:32:51 +00:00
|
|
|
//@ 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
|
2019-03-03 19:28:05 +00:00
|
|
|
|
2023-10-19 21:46:28 +00:00
|
|
|
// Test that we get the correct message for resuming a panicked coroutine.
|
2019-03-03 19:28:05 +00:00
|
|
|
|
2024-04-11 13:15:34 +00:00
|
|
|
#![feature(coroutines, coroutine_trait, stmt_expr_attributes)]
|
2019-03-03 19:28:05 +00:00
|
|
|
|
|
|
|
use std::{
|
2023-10-19 16:06:43 +00:00
|
|
|
ops::Coroutine,
|
2019-03-03 19:28:05 +00:00
|
|
|
pin::Pin,
|
|
|
|
panic,
|
|
|
|
};
|
|
|
|
|
|
|
|
fn main() {
|
2024-04-11 13:15:34 +00:00
|
|
|
let mut g = #[coroutine] || {
|
2019-03-03 19:28:05 +00:00
|
|
|
panic!();
|
|
|
|
yield;
|
|
|
|
};
|
|
|
|
panic::catch_unwind(panic::AssertUnwindSafe(|| {
|
2020-01-25 19:03:10 +00:00
|
|
|
let x = Pin::new(&mut g).resume(());
|
2019-03-03 19:28:05 +00:00
|
|
|
}));
|
2020-01-25 19:03:10 +00:00
|
|
|
Pin::new(&mut g).resume(());
|
2019-03-03 19:28:05 +00:00
|
|
|
}
|