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