2020-04-16 01:50:32 -05:00
|
|
|
// run-fail
|
2021-12-03 09:32:51 -06:00
|
|
|
// needs-unwind
|
2019-03-03 13:28:05 -06:00
|
|
|
// error-pattern:generator resumed after panicking
|
2020-05-07 10:39:02 -05:00
|
|
|
// ignore-emscripten no processes
|
2019-03-03 13:28:05 -06:00
|
|
|
|
|
|
|
// Test that we get the correct message for resuming a panicked generator.
|
|
|
|
|
|
|
|
#![feature(generators, generator_trait)]
|
|
|
|
|
|
|
|
use std::{
|
|
|
|
ops::Generator,
|
|
|
|
pin::Pin,
|
|
|
|
panic,
|
|
|
|
};
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut g = || {
|
|
|
|
panic!();
|
|
|
|
yield;
|
|
|
|
};
|
|
|
|
panic::catch_unwind(panic::AssertUnwindSafe(|| {
|
2020-01-25 13:03:10 -06:00
|
|
|
let x = Pin::new(&mut g).resume(());
|
2019-03-03 13:28:05 -06:00
|
|
|
}));
|
2020-01-25 13:03:10 -06:00
|
|
|
Pin::new(&mut g).resume(());
|
2019-03-03 13:28:05 -06:00
|
|
|
}
|