rust/tests/mir-opt/fn_ptr_shim.rs
2023-01-11 09:32:08 +00:00

16 lines
355 B
Rust

// 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
fn main() {
call(noop as fn());
}
fn noop() {}
fn call<F: Fn()>(f: F) {
f();
}