Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the correct state for poisoning a generator
- Loading branch information
1 parent
8a78019
commit 5e68c57
Showing
2 changed files
with
42 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// error-pattern:generator resumed after panicking | ||
|
||
// 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(|| { | ||
let x = Pin::new(&mut g).resume(); | ||
})); | ||
Pin::new(&mut g).resume(); | ||
} |