about summary refs log tree commit diff
path: root/tests/mir-opt/inline_fn_call_for_fn_def.rs
blob: 7601feda573256c5889dca4e28642e68ffcd15ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//@ test-mir-pass: Inline
//@ compile-flags: --crate-type=lib -C panic=abort

// EMIT_MIR inline_fn_call_for_fn_def.test.Inline.diff

fn inline_fn(x: impl FnOnce() -> i32) -> i32 {
    x()
}

fn yield_number() -> i32 {
    64
}

fn test() -> i32 {
    // CHECK: (inlined inline_fn::<fn() -> i32 {yield_number}>)
    // CHECK: (inlined <fn() -> i32 {yield_number} as FnOnce<()>>::call_once - shim(fn() -> i32 {yield_number}))
    // CHECK: (inlined yield_number)
    inline_fn(yield_number)
}