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
508 B
Rust
Raw Normal View History

// skip-filecheck
2023-10-19 16:46:28 -05:00
//! Tests that coroutines 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
2023-10-19 16:46:28 -05:00
#![feature(coroutines, coroutine_trait)]
struct HasDrop;
impl Drop for HasDrop {
fn drop(&mut self) {}
}
fn callee() {}
2023-10-19 16:46:28 -05:00
// EMIT_MIR coroutine_tiny.main-{closure#0}.coroutine_resume.0.mir
fn main() {
let _gen = |_x: u8| {
let _d = HasDrop;
loop {
yield;
callee();
}
};
}