rust/tests/mir-opt/fn_ptr_shim.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
378 B
Rust
Raw Normal View History

// skip-filecheck
//@ compile-flags: -Zmir-opt-level=0
2020-06-15 18:54:40 +00:00
// 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).
2020-07-27 19:22:43 +00:00
// EMIT_MIR core.ops-function-Fn-call.AddMovesForPackedDrops.before.mir
pub fn main() {
2020-06-15 18:54:40 +00:00
call(noop as fn());
}
fn noop() {}
fn call<F: Fn()>(f: F) {
f();
}