1
Fork 0
rust/src/test/mir-opt/generator-tiny.rs

26 lines
458 B
Rust
Raw Normal View History

//! Tests that generators that cannot return or unwind don't have unnecessary
//! panic branches.
2020-03-20 11:09:32 +00:00
// compile-flags: -C panic=abort
#![feature(generators, generator_trait)]
struct HasDrop;
impl Drop for HasDrop {
fn drop(&mut self) {}
}
fn callee() {}
2020-04-02 21:09:01 +00:00
// EMIT_MIR rustc.main-{{closure}}.generator_resume.0.mir
fn main() {
let _gen = |_x: u8| {
let _d = HasDrop;
loop {
yield;
callee();
}
};
}