1 // compile-flags: -Z panic-in-drop=abort -O
4 // Ensure that unwinding code paths are eliminated from the output after
7 // This test uses ignore-msvc, because the expected optimization does not happen on targets using
8 // SEH exceptions with the new LLVM pass manager anymore, see
9 // https://github.com/llvm/llvm-project/issues/51311.
11 // CHECK-NOT: {{(call|invoke).*}}should_not_appear_in_output
13 #![crate_type = "lib"]
17 pub struct ExternDrop;
18 impl Drop for ExternDrop {
21 // This call may potentially unwind.
31 struct AssertNeverDrop;
32 impl Drop for AssertNeverDrop {
35 // This call should be optimized away as unreachable.
37 fn should_not_appear_in_output();
40 should_not_appear_in_output();
46 pub fn normal_drop(x: ExternDrop) {
47 let guard = AssertNeverDrop;
53 pub fn indirect_drop(x: Box<dyn Any>) {
54 let guard = AssertNeverDrop;