From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/mir-opt/fn_ptr_shim.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/mir-opt/fn_ptr_shim.rs (limited to 'tests/mir-opt/fn_ptr_shim.rs') diff --git a/tests/mir-opt/fn_ptr_shim.rs b/tests/mir-opt/fn_ptr_shim.rs new file mode 100644 index 000000000..64fbdc9de --- /dev/null +++ b/tests/mir-opt/fn_ptr_shim.rs @@ -0,0 +1,15 @@ +// compile-flags: -Zmir-opt-level=0 + +// Tests that the `` 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: F) { + f(); +} -- cgit v1.2.3