mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 10:45:18 +00:00
aef0f4024a
And suggest adding the `#[coroutine]` to the closure
29 lines
547 B
Rust
29 lines
547 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, stmt_expr_attributes)]
|
|
|
|
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 = #[coroutine]
|
|
|_x: u8| {
|
|
let _d = HasDrop;
|
|
loop {
|
|
yield;
|
|
callee();
|
|
}
|
|
};
|
|
}
|