Add test for unnecessary panic branches
This commit is contained in:
parent
8d9f633f4d
commit
2cbccced08
1 changed files with 34 additions and 0 deletions
34
src/test/mir-opt/generator-tiny.rs
Normal file
34
src/test/mir-opt/generator-tiny.rs
Normal file
|
@ -0,0 +1,34 @@
|
|||
//! Tests that generators that cannot return or unwind don't have unnecessary
|
||||
//! panic branches.
|
||||
|
||||
// compile-flags: -Zno-landing-pads
|
||||
|
||||
#![feature(generators, generator_trait)]
|
||||
|
||||
struct HasDrop;
|
||||
|
||||
impl Drop for HasDrop {
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
fn callee() {}
|
||||
|
||||
fn main() {
|
||||
let _gen = |_x: u8| {
|
||||
let _d = HasDrop;
|
||||
loop {
|
||||
yield;
|
||||
callee();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
|
||||
// START rustc.main-{{closure}}.generator_resume.0.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// switchInt(move _11) -> [0u32: bb1, 3u32: bb5, otherwise: bb6];
|
||||
// }
|
||||
// ...
|
||||
// END rustc.main-{{closure}}.generator_resume.0.mir
|
Loading…
Add table
Reference in a new issue