2023-10-16 12:36:39 -05:00
|
|
|
// skip-filecheck
|
2023-10-19 16:46:28 -05:00
|
|
|
//! Tests that coroutines that cannot return or unwind don't have unnecessary
|
2020-03-07 18:47:54 -06:00
|
|
|
//! 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
|
2020-03-07 18:47:54 -06:00
|
|
|
|
2024-04-11 08:15:34 -05:00
|
|
|
#![feature(coroutines, coroutine_trait, stmt_expr_attributes)]
|
2020-03-07 18:47:54 -06:00
|
|
|
|
|
|
|
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
|
2020-03-07 18:47:54 -06:00
|
|
|
fn main() {
|
2024-04-11 08:15:34 -05:00
|
|
|
let _gen = #[coroutine]
|
|
|
|
|_x: u8| {
|
2020-03-07 18:47:54 -06:00
|
|
|
let _d = HasDrop;
|
|
|
|
loop {
|
|
|
|
yield;
|
|
|
|
callee();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|