summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/inline/inline_generator.rs
blob: 2d71458c1741a7257875b9796463d31142aba7ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// compile-flags: -Zinline-mir-hint-threshold=1000
#![feature(generators, generator_trait)]

use std::ops::Generator;
use std::pin::Pin;

// EMIT_MIR inline_generator.main.Inline.diff
fn main() {
    let _r = Pin::new(&mut g()).resume(false);
}

#[inline]
pub fn g() -> impl Generator<bool> {
    #[inline]
    |a| { yield if a { 7 } else { 13 } }
}