rust/tests/mir-opt/generator_tiny.rs

27 lines
488 B
Rust
Raw Normal View History

//! Tests that generators that cannot return or unwind don't have unnecessary
//! panic branches.
2020-03-20 06:09:32 -05:00
// compile-flags: -C panic=abort
2020-03-31 17:41:45 -05:00
// no-prefer-dynamic
#![feature(generators, generator_trait)]
struct HasDrop;
impl Drop for HasDrop {
fn drop(&mut self) {}
}
fn callee() {}
// EMIT_MIR generator_tiny.main-{closure#0}.generator_resume.0.mir
fn main() {
let _gen = |_x: u8| {
let _d = HasDrop;
loop {
yield;
callee();
}
};
}