rust/tests/mir-opt/coroutine_tiny.rs
2023-10-20 21:14:01 +00:00

28 lines
506 B
Rust

// skip-filecheck
//! Tests that coroutines that cannot return or unwind don't have unnecessary
//! panic branches.
// compile-flags: -C panic=abort
// no-prefer-dynamic
#![feature(coroutines, coroutine_trait)]
struct HasDrop;
impl Drop for HasDrop {
fn drop(&mut self) {}
}
fn callee() {}
// EMIT_MIR coroutine_tiny.main-{closure#0}.coroutine_resume.0.mir
fn main() {
let _gen = |_x: u8| {
let _d = HasDrop;
loop {
yield;
callee();
}
};
}