about summary refs log tree commit diff
path: root/tests/mir-opt/fn_ptr_shim.rs
blob: 2650cbf9704f3239c99c23dc13bca433e21c19f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// skip-filecheck
// compile-flags: -Zmir-opt-level=0

// Tests that the `<fn() as Fn>` shim does not create a `Call` terminator with a `Self` callee
// (as only `FnDef` and `FnPtr` callees are allowed in MIR).

// EMIT_MIR core.ops-function-Fn-call.AddMovesForPackedDrops.before.mir
pub fn main() {
    call(noop as fn());
}

fn noop() {}

fn call<F: Fn()>(f: F) {
    f();
}