rust/tests/mir-opt/coroutine_tiny.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
506 B
Rust
Raw Normal View History

// skip-filecheck
2023-10-20 05:46:28 +08:00
//! Tests that coroutines that cannot return or unwind don't have unnecessary
//! panic branches.
2020-03-20 19:09:32 +08:00
// compile-flags: -C panic=abort
2020-04-01 06:41:45 +08:00
// no-prefer-dynamic
2023-10-20 05:46:28 +08:00
#![feature(coroutines, coroutine_trait)]
struct HasDrop;
impl Drop for HasDrop {
fn drop(&mut self) {}
}
fn callee() {}
2023-10-20 05:46:28 +08:00
// EMIT_MIR coroutine_tiny.main-{closure#0}.coroutine_resume.0.mir
fn main() {
let _gen = |_x: u8| {
let _d = HasDrop;
loop {
yield;
callee();
}
};
}