rust/tests/mir-opt/inline/inline_coroutine.rs

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

22 lines
512 B
Rust
Raw Normal View History

// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ compile-flags: -Zinline-mir-hint-threshold=1000 -C debuginfo=full
2023-10-19 16:46:28 -05:00
#![feature(coroutines, coroutine_trait)]
2023-10-19 11:06:43 -05:00
use std::ops::Coroutine;
use std::pin::Pin;
2023-10-19 16:46:28 -05:00
// EMIT_MIR inline_coroutine.main.Inline.diff
fn main() {
2023-10-20 20:15:32 -05:00
// CHECK-LABEL: fn main(
// CHECK: (inlined g)
// CHECK: (inlined g::{closure#0})
let _r = Pin::new(&mut g()).resume(false);
}
#[inline]
2023-10-19 11:06:43 -05:00
pub fn g() -> impl Coroutine<bool> {
#[inline]
#[coroutine]
|a| yield if a { 7 } else { 13 }
}