]> git.lizzy.rs Git - rust.git/blob - tests/mir-opt/fn_ptr_shim.rs
Rollup merge of #107769 - compiler-errors:pointer-like, r=eholk
[rust.git] / tests / mir-opt / fn_ptr_shim.rs
1 // compile-flags: -Zmir-opt-level=0
2
3 // Tests that the `<fn() as Fn>` shim does not create a `Call` terminator with a `Self` callee
4 // (as only `FnDef` and `FnPtr` callees are allowed in MIR).
5
6 // EMIT_MIR core.ops-function-Fn-call.AddMovesForPackedDrops.before.mir
7 fn main() {
8     call(noop as fn());
9 }
10
11 fn noop() {}
12
13 fn call<F: Fn()>(f: F) {
14     f();
15 }