Auto merge of #115045 - RalfJung:unwind-terminate-reason, r=davidtwco
when terminating during unwinding, show the reason why
With this, the output on double-panic becomes something like that:
```
thread 'main' panicked at src/tools/miri/tests/fail/panic/double_panic.rs:15:5:
first
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at src/tools/miri/tests/fail/panic/double_panic.rs:10:9:
second
stack backtrace:
0: 0xbe273a - std::backtrace_rs::backtrace::miri::trace_unsynchronized::<&mut [closure@std::sys_common::backtrace::_print_fmt::{closure#1}]>
at /home/r/src/rust/rustc.3/library/std/src/../../backtrace/src/backtrace/miri.rs:99:5
1: 0xbe22e6 - std::backtrace_rs::backtrace::miri::trace::<&mut [closure@std::sys_common::backtrace::_print_fmt::{closure#1}]>
at /home/r/src/rust/rustc.3/library/std/src/../../backtrace/src/backtrace/miri.rs:62:14
2: 0xbe1086 - std::backtrace_rs::backtrace::trace_unsynchronized::<[closure@std::sys_common::backtrace::_print_fmt::{closure#1}]>
at /home/r/src/rust/rustc.3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
3: 0xba3afd - std::sys_common::backtrace::_print_fmt
at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:67:5
4: 0xba2471 - <std::sys_common::backtrace::_print::DisplayBacktrace as std::fmt::Display>::fmt
at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:44:22
5: 0xbcf754 - core::fmt::rt::Argument::<'_>::fmt
at /home/r/src/rust/rustc.3/library/core/src/fmt/rt.rs:138:9
6: 0x9b8f81 - std::fmt::write
at /home/r/src/rust/rustc.3/library/core/src/fmt/mod.rs:1094:17
7: 0x21391d - <std::sys::unix::stdio::Stderr as std::io::Write>::write_fmt
at /home/r/src/rust/rustc.3/library/std/src/io/mod.rs:1714:15
8: 0xba37b1 - std::sys_common::backtrace::_print
at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:47:5
9: 0xba365b - std::sys_common::backtrace::print
at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:34:9
10: 0x143c67 - std::panic_hook_with_disk_dump::{closure#1}
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:278:22
11: 0x144187 - std::panic_hook_with_disk_dump
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:312:9
12: 0x143659 - std::panicking::default_hook
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:239:5
13: 0x1482a7 - std::panicking::rust_panic_with_hook
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:729:13
14: 0x1475d5 - std::rt::begin_panic::<&str>::{closure#0}
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:650:9
15: 0xba496a - std::sys_common::backtrace::__rust_end_short_backtrace::<[closure@std::rt::begin_panic<&str>::{closure#0}], !>
at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:170:18
16: 0x147599 - std::rt::begin_panic::<&str>
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:649:12
17: 0x31916 - <Foo as std::ops::Drop>::drop
at src/tools/miri/tests/fail/panic/double_panic.rs:10:9
18: 0x1a2b5e - std::ptr::drop_in_place::<Foo> - shim(Some(Foo))
at /home/r/src/rust/rustc.3/library/core/src/ptr/mod.rs:497:1
19: 0x202bf - main
at src/tools/miri/tests/fail/panic/double_panic.rs:16:1
20: 0xcc6a8 - <fn() as std::ops::FnOnce<()>>::call_once - shim(fn())
at /home/r/src/rust/rustc.3/library/core/src/ops/function.rs:250:5
21: 0xba47d9 - std::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>
at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:154:18
22: 0x141a6a - std::rt::lang_start::<()>::{closure#0}
at /home/r/src/rust/rustc.3/library/std/src/rt.rs:166:18
23: 0xcca18 - std::ops::function::impls::<impl std::ops::FnOnce<()> for &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>::call_once
at /home/r/src/rust/rustc.3/library/core/src/ops/function.rs:284:13
24: 0x146469 - std::panicking::try::do_call::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:524:40
25: 0x145e09 - std::panicking::try::<i32, &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:488:19
26: 0x7b0ac - std::panic::catch_unwind::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>
at /home/r/src/rust/rustc.3/library/std/src/panic.rs:142:14
27: 0x14189b - std::rt::lang_start_internal::{closure#2}
at /home/r/src/rust/rustc.3/library/std/src/rt.rs:148:48
28: 0x146481 - std::panicking::try::do_call::<[closure@std::rt::lang_start_internal::{closure#2}], isize>
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:524:40
29: 0x145e2c - std::panicking::try::<isize, [closure@std::rt::lang_start_internal::{closure#2}]>
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:488:19
30: 0x7b0d5 - std::panic::catch_unwind::<[closure@std::rt::lang_start_internal::{closure#2}], isize>
at /home/r/src/rust/rustc.3/library/std/src/panic.rs:142:14
31: 0x1418b0 - std::rt::lang_start_internal
at /home/r/src/rust/rustc.3/library/std/src/rt.rs:148:20
32: 0x141a97 - std::rt::lang_start::<()>
at /home/r/src/rust/rustc.3/library/std/src/rt.rs:165:17
thread 'main' panicked at /home/r/src/rust/rustc.3/library/core/src/panicking.rs:126:5:
panic in a destructor during cleanup
stack backtrace:
0: 0xe9f6d7 - std::backtrace_rs::backtrace::miri::trace_unsynchronized::<&mut [closure@std::sys_common::backtrace::_print_fmt::{closure#1}]>
at /home/r/src/rust/rustc.3/library/std/src/../../backtrace/src/backtrace/miri.rs:99:5
1: 0xe9f27d - std::backtrace_rs::backtrace::miri::trace::<&mut [closure@std::sys_common::backtrace::_print_fmt::{closure#1}]>
at /home/r/src/rust/rustc.3/library/std/src/../../backtrace/src/backtrace/miri.rs:62:14
2: 0xe9e016 - std::backtrace_rs::backtrace::trace_unsynchronized::<[closure@std::sys_common::backtrace::_print_fmt::{closure#1}]>
at /home/r/src/rust/rustc.3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
3: 0xba3afd - std::sys_common::backtrace::_print_fmt
at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:67:5
4: 0xba2471 - <std::sys_common::backtrace::_print::DisplayBacktrace as std::fmt::Display>::fmt
at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:44:22
5: 0xbcf754 - core::fmt::rt::Argument::<'_>::fmt
at /home/r/src/rust/rustc.3/library/core/src/fmt/rt.rs:138:9
6: 0x9b8f81 - std::fmt::write
at /home/r/src/rust/rustc.3/library/core/src/fmt/mod.rs:1094:17
7: 0x4d0895 - <std::sys::unix::stdio::Stderr as std::io::Write>::write_fmt
at /home/r/src/rust/rustc.3/library/std/src/io/mod.rs:1714:15
8: 0xba37b1 - std::sys_common::backtrace::_print
at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:47:5
9: 0xba365b - std::sys_common::backtrace::print
at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:34:9
10: 0x400bd4 - std::panic_hook_with_disk_dump::{closure#1}
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:278:22
11: 0x144187 - std::panic_hook_with_disk_dump
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:312:9
12: 0x143659 - std::panicking::default_hook
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:239:5
13: 0x1482a7 - std::panicking::rust_panic_with_hook
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:729:13
14: 0x40403b - std::panicking::begin_panic_handler::{closure#0}
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:619:13
15: 0xe618b3 - std::sys_common::backtrace::__rust_end_short_backtrace::<[closure@std::panicking::begin_panic_handler::{closure#0}], !>
at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:170:18
16: 0x403fc8 - std::panicking::begin_panic_handler
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:617:5
17: 0xee23e9 - core::panicking::panic_nounwind_fmt
at /home/r/src/rust/rustc.3/library/core/src/panicking.rs:96:14
18: 0xee29e6 - core::panicking::panic_nounwind
at /home/r/src/rust/rustc.3/library/core/src/panicking.rs:126:5
19: 0xee365e - core::panicking::panic_in_cleanup
at /home/r/src/rust/rustc.3/library/core/src/panicking.rs:206:5
20: 0x2028a - main
at src/tools/miri/tests/fail/panic/double_panic.rs:13:1
21: 0x3895ee - <fn() as std::ops::FnOnce<()>>::call_once - shim(fn())
at /home/r/src/rust/rustc.3/library/core/src/ops/function.rs:250:5
22: 0xe61725 - std::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>
at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:154:18
23: 0x3fe9aa - std::rt::lang_start::<()>::{closure#0}
at /home/r/src/rust/rustc.3/library/std/src/rt.rs:166:18
24: 0x389962 - std::ops::function::impls::<impl std::ops::FnOnce<()> for &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>::call_once
at /home/r/src/rust/rustc.3/library/core/src/ops/function.rs:284:13
25: 0x4033b9 - std::panicking::try::do_call::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:524:40
26: 0x402d58 - std::panicking::try::<i32, &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:488:19
27: 0x337ff7 - std::panic::catch_unwind::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>
at /home/r/src/rust/rustc.3/library/std/src/panic.rs:142:14
28: 0x3fe7e7 - std::rt::lang_start_internal::{closure#2}
at /home/r/src/rust/rustc.3/library/std/src/rt.rs:148:48
29: 0x4033d6 - std::panicking::try::do_call::<[closure@std::rt::lang_start_internal::{closure#2}], isize>
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:524:40
30: 0x402d7f - std::panicking::try::<isize, [closure@std::rt::lang_start_internal::{closure#2}]>
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:488:19
31: 0x338028 - std::panic::catch_unwind::<[closure@std::rt::lang_start_internal::{closure#2}], isize>
at /home/r/src/rust/rustc.3/library/std/src/panic.rs:142:14
32: 0x1418b0 - std::rt::lang_start_internal
at /home/r/src/rust/rustc.3/library/std/src/rt.rs:148:20
33: 0x3fe9dc - std::rt::lang_start::<()>
at /home/r/src/rust/rustc.3/library/std/src/rt.rs:165:17
thread caused non-unwinding panic. aborting.
```
If we also land https://github.com/rust-lang/rust/pull/115020, the 2nd backtrace disappears, hopefully making the "panic in a destructor during cleanup" easier to see.
Fixes https://github.com/rust-lang/rust/issues/114954.
This commit is contained in:
@@ -9,7 +9,7 @@ fn main() -> () {
|
||||
bb0: {
|
||||
StorageLive(_1);
|
||||
_1 = const ();
|
||||
asm!("", options(MAY_UNWIND)) -> [return: bb1, unwind terminate];
|
||||
asm!("", options(MAY_UNWIND)) -> [return: bb1, unwind terminate(abi)];
|
||||
}
|
||||
|
||||
bb1: {
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
bb2 (cleanup): {
|
||||
_5 = move _6;
|
||||
- drop(_6) -> [return: bb6, unwind terminate];
|
||||
- drop(_6) -> [return: bb6, unwind terminate(cleanup)];
|
||||
+ goto -> bb6;
|
||||
}
|
||||
|
||||
@@ -71,12 +71,12 @@
|
||||
}
|
||||
|
||||
bb6 (cleanup): {
|
||||
- drop(_5) -> [return: bb7, unwind terminate];
|
||||
- drop(_5) -> [return: bb7, unwind terminate(cleanup)];
|
||||
+ goto -> bb7;
|
||||
}
|
||||
|
||||
bb7 (cleanup): {
|
||||
- drop(_4) -> [return: bb8, unwind terminate];
|
||||
- drop(_4) -> [return: bb8, unwind terminate(cleanup)];
|
||||
+ goto -> bb8;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ fn main() -> () {
|
||||
|
||||
bb2 (cleanup): {
|
||||
_5 = move _6;
|
||||
drop(_6) -> [return: bb6, unwind terminate];
|
||||
drop(_6) -> [return: bb6, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb3: {
|
||||
@@ -73,11 +73,11 @@ fn main() -> () {
|
||||
}
|
||||
|
||||
bb6 (cleanup): {
|
||||
drop(_5) -> [return: bb7, unwind terminate];
|
||||
drop(_5) -> [return: bb7, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb7 (cleanup): {
|
||||
drop(_4) -> [return: bb8, unwind terminate];
|
||||
drop(_4) -> [return: bb8, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb8 (cleanup): {
|
||||
|
||||
@@ -54,15 +54,15 @@ fn main() -> () {
|
||||
}
|
||||
|
||||
bb6 (cleanup): {
|
||||
drop(_7) -> [return: bb7, unwind terminate];
|
||||
drop(_7) -> [return: bb7, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb7 (cleanup): {
|
||||
drop(_1) -> [return: bb9, unwind terminate];
|
||||
drop(_1) -> [return: bb9, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb8 (cleanup): {
|
||||
drop(_5) -> [return: bb9, unwind terminate];
|
||||
drop(_5) -> [return: bb9, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb9 (cleanup): {
|
||||
|
||||
@@ -54,15 +54,15 @@ fn main() -> () {
|
||||
}
|
||||
|
||||
bb6 (cleanup): {
|
||||
drop(_7) -> [return: bb7, unwind terminate];
|
||||
drop(_7) -> [return: bb7, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb7 (cleanup): {
|
||||
drop(_1) -> [return: bb9, unwind terminate];
|
||||
drop(_1) -> [return: bb9, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb8 (cleanup): {
|
||||
drop(_5) -> [return: bb9, unwind terminate];
|
||||
drop(_5) -> [return: bb9, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb9 (cleanup): {
|
||||
|
||||
@@ -62,7 +62,7 @@ fn droppy() -> () {
|
||||
}
|
||||
|
||||
bb4 (cleanup): {
|
||||
drop(_2) -> [return: bb5, unwind terminate];
|
||||
drop(_2) -> [return: bb5, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb5 (cleanup): {
|
||||
|
||||
@@ -89,15 +89,15 @@ fn move_out_by_subslice() -> () {
|
||||
}
|
||||
|
||||
bb9 (cleanup): {
|
||||
drop(_1) -> [return: bb12, unwind terminate];
|
||||
drop(_1) -> [return: bb12, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb10 (cleanup): {
|
||||
drop(_7) -> [return: bb11, unwind terminate];
|
||||
drop(_7) -> [return: bb11, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb11 (cleanup): {
|
||||
drop(_2) -> [return: bb12, unwind terminate];
|
||||
drop(_2) -> [return: bb12, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb12 (cleanup): {
|
||||
|
||||
@@ -89,15 +89,15 @@ fn move_out_from_end() -> () {
|
||||
}
|
||||
|
||||
bb9 (cleanup): {
|
||||
drop(_1) -> [return: bb12, unwind terminate];
|
||||
drop(_1) -> [return: bb12, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb10 (cleanup): {
|
||||
drop(_7) -> [return: bb11, unwind terminate];
|
||||
drop(_7) -> [return: bb11, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb11 (cleanup): {
|
||||
drop(_2) -> [return: bb12, unwind terminate];
|
||||
drop(_2) -> [return: bb12, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb12 (cleanup): {
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
}
|
||||
|
||||
bb4 (cleanup): {
|
||||
drop(_2) -> [return: bb5, unwind terminate];
|
||||
drop(_2) -> [return: bb5, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb5 (cleanup): {
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
}
|
||||
|
||||
bb4 (cleanup): {
|
||||
drop(_2) -> [return: bb5, unwind terminate];
|
||||
drop(_2) -> [return: bb5, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb5 (cleanup): {
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
}
|
||||
|
||||
bb4 (cleanup): {
|
||||
drop(_2) -> [return: bb5, unwind terminate];
|
||||
drop(_2) -> [return: bb5, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb5 (cleanup): {
|
||||
|
||||
@@ -104,7 +104,7 @@ yields ()
|
||||
|
||||
bb13 (cleanup): {
|
||||
StorageDead(_3);
|
||||
drop(_1) -> [return: bb14, unwind terminate];
|
||||
drop(_1) -> [return: bb14, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb14 (cleanup): {
|
||||
@@ -113,6 +113,6 @@ yields ()
|
||||
|
||||
bb15 (cleanup): {
|
||||
StorageDead(_3);
|
||||
drop(_1) -> [return: bb14, unwind terminate];
|
||||
drop(_1) -> [return: bb14, unwind terminate(cleanup)];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
StorageLive(_1);
|
||||
- _1 = foo() -> [return: bb1, unwind unreachable];
|
||||
+ StorageLive(_2);
|
||||
+ asm!("", options(MAY_UNWIND)) -> [return: bb2, unwind terminate];
|
||||
+ asm!("", options(MAY_UNWIND)) -> [return: bb2, unwind terminate(abi)];
|
||||
}
|
||||
|
||||
bb1: {
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
+ }
|
||||
+
|
||||
+ bb3 (cleanup): {
|
||||
+ drop(_2) -> [return: bb4, unwind terminate];
|
||||
+ drop(_2) -> [return: bb4, unwind terminate(cleanup)];
|
||||
+ }
|
||||
+
|
||||
+ bb4 (cleanup): {
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
}
|
||||
|
||||
bb3 (cleanup): {
|
||||
drop(_1) -> [return: bb4, unwind terminate];
|
||||
drop(_1) -> [return: bb4, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb4 (cleanup): {
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
+ }
|
||||
+
|
||||
+ bb3 (cleanup): {
|
||||
+ drop(_2) -> [return: bb4, unwind terminate];
|
||||
+ drop(_2) -> [return: bb4, unwind terminate(cleanup)];
|
||||
+ }
|
||||
+
|
||||
+ bb4 (cleanup): {
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
+ }
|
||||
+
|
||||
+ bb3 (cleanup): {
|
||||
+ drop(_2) -> [return: bb4, unwind terminate];
|
||||
+ drop(_2) -> [return: bb4, unwind terminate(cleanup)];
|
||||
+ }
|
||||
+
|
||||
+ bb4 (cleanup): {
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
}
|
||||
|
||||
bb3 (cleanup): {
|
||||
drop(_1) -> [return: bb4, unwind terminate];
|
||||
drop(_1) -> [return: bb4, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb4 (cleanup): {
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
}
|
||||
|
||||
bb3 (cleanup): {
|
||||
drop(_1) -> [return: bb4, unwind terminate];
|
||||
drop(_1) -> [return: bb4, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb4 (cleanup): {
|
||||
|
||||
@@ -54,11 +54,11 @@
|
||||
+ }
|
||||
+
|
||||
+ bb4 (cleanup): {
|
||||
+ drop(_4) -> [return: bb5, unwind terminate];
|
||||
+ drop(_4) -> [return: bb5, unwind terminate(cleanup)];
|
||||
+ }
|
||||
+
|
||||
+ bb5 (cleanup): {
|
||||
+ drop(_2) -> [return: bb6, unwind terminate];
|
||||
+ drop(_2) -> [return: bb6, unwind terminate(cleanup)];
|
||||
+ }
|
||||
+
|
||||
+ bb6 (cleanup): {
|
||||
|
||||
@@ -155,7 +155,7 @@
|
||||
- StorageDead(_1);
|
||||
- return;
|
||||
+ bb3 (cleanup): {
|
||||
+ drop(_2) -> [return: bb2, unwind terminate];
|
||||
+ drop(_2) -> [return: bb2, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
- bb4 (cleanup): {
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
}
|
||||
|
||||
bb4 (cleanup): {
|
||||
drop(_1) -> [return: bb5, unwind terminate];
|
||||
drop(_1) -> [return: bb5, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb5 (cleanup): {
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
}
|
||||
|
||||
bb4 (cleanup): {
|
||||
drop(_1) -> [return: bb5, unwind terminate];
|
||||
drop(_1) -> [return: bb5, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb5 (cleanup): {
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
bb4 (cleanup): {
|
||||
_8 = &mut _3;
|
||||
_9 = <Box<[i32]> as Drop>::drop(move _8) -> [return: bb1, unwind terminate];
|
||||
_9 = <Box<[i32]> as Drop>::drop(move _8) -> [return: bb1, unwind terminate(cleanup)];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,17 +40,17 @@
|
||||
}
|
||||
|
||||
bb3 (cleanup): {
|
||||
- drop(_3) -> [return: bb5, unwind terminate];
|
||||
- drop(_3) -> [return: bb5, unwind terminate(cleanup)];
|
||||
+ goto -> bb5;
|
||||
}
|
||||
|
||||
bb4 (cleanup): {
|
||||
- drop(_4) -> [return: bb5, unwind terminate];
|
||||
- drop(_4) -> [return: bb5, unwind terminate(cleanup)];
|
||||
+ goto -> bb5;
|
||||
}
|
||||
|
||||
bb5 (cleanup): {
|
||||
- drop(_2) -> [return: bb6, unwind terminate];
|
||||
- drop(_2) -> [return: bb6, unwind terminate(cleanup)];
|
||||
+ goto -> bb8;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
+ }
|
||||
+
|
||||
+ bb7 (cleanup): {
|
||||
+ drop(_2) -> [return: bb6, unwind terminate];
|
||||
+ drop(_2) -> [return: bb6, unwind terminate(cleanup)];
|
||||
+ }
|
||||
+
|
||||
+ bb8 (cleanup): {
|
||||
|
||||
@@ -40,17 +40,17 @@
|
||||
}
|
||||
|
||||
bb3 (cleanup): {
|
||||
- drop(_3) -> [return: bb5, unwind terminate];
|
||||
- drop(_3) -> [return: bb5, unwind terminate(cleanup)];
|
||||
+ goto -> bb5;
|
||||
}
|
||||
|
||||
bb4 (cleanup): {
|
||||
- drop(_4) -> [return: bb5, unwind terminate];
|
||||
- drop(_4) -> [return: bb5, unwind terminate(cleanup)];
|
||||
+ goto -> bb5;
|
||||
}
|
||||
|
||||
bb5 (cleanup): {
|
||||
- drop(_2) -> [return: bb6, unwind terminate];
|
||||
- drop(_2) -> [return: bb6, unwind terminate(cleanup)];
|
||||
+ goto -> bb8;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
+ }
|
||||
+
|
||||
+ bb7 (cleanup): {
|
||||
+ drop(_2) -> [return: bb6, unwind terminate];
|
||||
+ drop(_2) -> [return: bb6, unwind terminate(cleanup)];
|
||||
+ }
|
||||
+
|
||||
+ bb8 (cleanup): {
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
bb3 (cleanup): {
|
||||
_2 = move _5;
|
||||
- drop(_5) -> [return: bb8, unwind terminate];
|
||||
- drop(_5) -> [return: bb8, unwind terminate(cleanup)];
|
||||
+ goto -> bb8;
|
||||
}
|
||||
|
||||
@@ -70,17 +70,17 @@
|
||||
}
|
||||
|
||||
bb7 (cleanup): {
|
||||
- drop(_4) -> [return: bb8, unwind terminate];
|
||||
- drop(_4) -> [return: bb8, unwind terminate(cleanup)];
|
||||
+ goto -> bb8;
|
||||
}
|
||||
|
||||
bb8 (cleanup): {
|
||||
- drop(_2) -> [return: bb9, unwind terminate];
|
||||
- drop(_2) -> [return: bb9, unwind terminate(cleanup)];
|
||||
+ goto -> bb9;
|
||||
}
|
||||
|
||||
bb9 (cleanup): {
|
||||
- drop(_1) -> [return: bb10, unwind terminate];
|
||||
- drop(_1) -> [return: bb10, unwind terminate(cleanup)];
|
||||
+ goto -> bb12;
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
+ }
|
||||
+
|
||||
+ bb11 (cleanup): {
|
||||
+ drop(_1) -> [return: bb10, unwind terminate];
|
||||
+ drop(_1) -> [return: bb10, unwind terminate(cleanup)];
|
||||
+ }
|
||||
+
|
||||
+ bb12 (cleanup): {
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
bb3 (cleanup): {
|
||||
_2 = move _5;
|
||||
- drop(_5) -> [return: bb8, unwind terminate];
|
||||
- drop(_5) -> [return: bb8, unwind terminate(cleanup)];
|
||||
+ goto -> bb8;
|
||||
}
|
||||
|
||||
@@ -70,17 +70,17 @@
|
||||
}
|
||||
|
||||
bb7 (cleanup): {
|
||||
- drop(_4) -> [return: bb8, unwind terminate];
|
||||
- drop(_4) -> [return: bb8, unwind terminate(cleanup)];
|
||||
+ goto -> bb8;
|
||||
}
|
||||
|
||||
bb8 (cleanup): {
|
||||
- drop(_2) -> [return: bb9, unwind terminate];
|
||||
- drop(_2) -> [return: bb9, unwind terminate(cleanup)];
|
||||
+ goto -> bb9;
|
||||
}
|
||||
|
||||
bb9 (cleanup): {
|
||||
- drop(_1) -> [return: bb10, unwind terminate];
|
||||
- drop(_1) -> [return: bb10, unwind terminate(cleanup)];
|
||||
+ goto -> bb12;
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
+ }
|
||||
+
|
||||
+ bb11 (cleanup): {
|
||||
+ drop(_1) -> [return: bb10, unwind terminate];
|
||||
+ drop(_1) -> [return: bb10, unwind terminate(cleanup)];
|
||||
+ }
|
||||
+
|
||||
+ bb12 (cleanup): {
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
+ _8 = const true;
|
||||
+ _9 = const true;
|
||||
_1 = move _3;
|
||||
- drop(_3) -> [return: bb11, unwind terminate];
|
||||
- drop(_3) -> [return: bb11, unwind terminate(cleanup)];
|
||||
+ goto -> bb11;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
}
|
||||
|
||||
bb11 (cleanup): {
|
||||
- drop(_1) -> [return: bb12, unwind terminate];
|
||||
- drop(_1) -> [return: bb12, unwind terminate(cleanup)];
|
||||
+ goto -> bb12;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
+ }
|
||||
+
|
||||
+ bb16 (cleanup): {
|
||||
+ drop(_1) -> [return: bb12, unwind terminate];
|
||||
+ drop(_1) -> [return: bb12, unwind terminate(cleanup)];
|
||||
+ }
|
||||
+
|
||||
+ bb17: {
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
+ _8 = const true;
|
||||
+ _9 = const true;
|
||||
_1 = move _3;
|
||||
- drop(_3) -> [return: bb11, unwind terminate];
|
||||
- drop(_3) -> [return: bb11, unwind terminate(cleanup)];
|
||||
+ goto -> bb11;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
}
|
||||
|
||||
bb11 (cleanup): {
|
||||
- drop(_1) -> [return: bb12, unwind terminate];
|
||||
- drop(_1) -> [return: bb12, unwind terminate(cleanup)];
|
||||
+ goto -> bb12;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
+ }
|
||||
+
|
||||
+ bb16 (cleanup): {
|
||||
+ drop(_1) -> [return: bb12, unwind terminate];
|
||||
+ drop(_1) -> [return: bb12, unwind terminate(cleanup)];
|
||||
+ }
|
||||
+
|
||||
+ bb17: {
|
||||
|
||||
@@ -100,11 +100,11 @@ fn test() -> Option<Box<u32>> {
|
||||
}
|
||||
|
||||
bb11 (cleanup): {
|
||||
drop(_1) -> [return: bb13, unwind terminate];
|
||||
drop(_1) -> [return: bb13, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb12 (cleanup): {
|
||||
drop(_5) -> [return: bb13, unwind terminate];
|
||||
drop(_5) -> [return: bb13, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb13 (cleanup): {
|
||||
|
||||
@@ -100,11 +100,11 @@ fn test() -> Option<Box<u32>> {
|
||||
}
|
||||
|
||||
bb11 (cleanup): {
|
||||
drop(_1) -> [return: bb13, unwind terminate];
|
||||
drop(_1) -> [return: bb13, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb12 (cleanup): {
|
||||
drop(_5) -> [return: bb13, unwind terminate];
|
||||
drop(_5) -> [return: bb13, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb13 (cleanup): {
|
||||
|
||||
@@ -28,7 +28,7 @@ fn bar(_1: Box<[T]>) -> () {
|
||||
}
|
||||
|
||||
bb3 (cleanup): {
|
||||
drop(_1) -> [return: bb4, unwind terminate];
|
||||
drop(_1) -> [return: bb4, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb4 (cleanup): {
|
||||
|
||||
@@ -45,7 +45,7 @@ fn foo(_1: Box<[T]>) -> T {
|
||||
}
|
||||
|
||||
bb5 (cleanup): {
|
||||
drop(_1) -> [return: bb6, unwind terminate];
|
||||
drop(_1) -> [return: bb6, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb6 (cleanup): {
|
||||
|
||||
@@ -243,7 +243,7 @@
|
||||
}
|
||||
|
||||
- bb25 (cleanup): {
|
||||
- drop(_2) -> [return: bb26, unwind terminate];
|
||||
- drop(_2) -> [return: bb26, unwind terminate(cleanup)];
|
||||
+ bb22 (cleanup): {
|
||||
+ goto -> bb27;
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@
|
||||
}
|
||||
|
||||
- bb25 (cleanup): {
|
||||
- drop(_2) -> [return: bb26, unwind terminate];
|
||||
- drop(_2) -> [return: bb26, unwind terminate(cleanup)];
|
||||
+ bb22 (cleanup): {
|
||||
+ goto -> bb27;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ fn main() -> () {
|
||||
}
|
||||
|
||||
bb3 (cleanup): {
|
||||
drop(_2) -> [return: bb4, unwind terminate];
|
||||
drop(_2) -> [return: bb4, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb4 (cleanup): {
|
||||
|
||||
@@ -31,7 +31,7 @@ fn main() -> () {
|
||||
}
|
||||
|
||||
bb3 (cleanup): {
|
||||
drop(_2) -> [return: bb4, unwind terminate];
|
||||
drop(_2) -> [return: bb4, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb4 (cleanup): {
|
||||
|
||||
@@ -33,7 +33,7 @@ fn main() -> () {
|
||||
|
||||
bb1 (cleanup): {
|
||||
(_1.0: Aligned) = move _4;
|
||||
drop(_1) -> [return: bb3, unwind terminate];
|
||||
drop(_1) -> [return: bb3, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb2: {
|
||||
|
||||
@@ -83,7 +83,7 @@ fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> ()
|
||||
}
|
||||
|
||||
bb9 (cleanup): {
|
||||
drop(_5) -> [return: bb10, unwind terminate];
|
||||
drop(_5) -> [return: bb10, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb10 (cleanup): {
|
||||
|
||||
@@ -75,7 +75,7 @@ fn mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> U) -> () {
|
||||
}
|
||||
|
||||
bb9 (cleanup): {
|
||||
drop(_5) -> [return: bb10, unwind terminate];
|
||||
drop(_5) -> [return: bb10, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb10 (cleanup): {
|
||||
|
||||
@@ -67,7 +67,7 @@ fn vec_move(_1: Vec<impl Sized>) -> () {
|
||||
}
|
||||
|
||||
bb9 (cleanup): {
|
||||
drop(_3) -> [return: bb10, unwind terminate];
|
||||
drop(_3) -> [return: bb10, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb10 (cleanup): {
|
||||
|
||||
@@ -127,7 +127,7 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
|
||||
}
|
||||
|
||||
bb11 (cleanup): {
|
||||
drop(_3) -> [return: bb12, unwind terminate];
|
||||
drop(_3) -> [return: bb12, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb12 (cleanup): {
|
||||
|
||||
@@ -82,7 +82,7 @@ fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
|
||||
}
|
||||
|
||||
bb8 (cleanup): {
|
||||
drop(_3) -> [return: bb9, unwind terminate];
|
||||
drop(_3) -> [return: bb9, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb9 (cleanup): {
|
||||
|
||||
@@ -195,7 +195,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
|
||||
}
|
||||
|
||||
bb11 (cleanup): {
|
||||
drop(_2) -> [return: bb12, unwind terminate];
|
||||
drop(_2) -> [return: bb12, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb12 (cleanup): {
|
||||
|
||||
@@ -182,7 +182,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
|
||||
}
|
||||
|
||||
bb11 (cleanup): {
|
||||
drop(_2) -> [return: bb12, unwind terminate];
|
||||
drop(_2) -> [return: bb12, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb12 (cleanup): {
|
||||
|
||||
@@ -143,7 +143,7 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
|
||||
}
|
||||
|
||||
bb12 (cleanup): {
|
||||
drop(_2) -> [return: bb13, unwind terminate];
|
||||
drop(_2) -> [return: bb13, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb13 (cleanup): {
|
||||
|
||||
@@ -196,7 +196,7 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
|
||||
}
|
||||
|
||||
bb11 (cleanup): {
|
||||
drop(_2) -> [return: bb12, unwind terminate];
|
||||
drop(_2) -> [return: bb12, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb12 (cleanup): {
|
||||
|
||||
@@ -167,11 +167,11 @@ fn main() -> () {
|
||||
}
|
||||
|
||||
bb7 (cleanup): {
|
||||
drop(_21) -> [return: bb9, unwind terminate];
|
||||
drop(_21) -> [return: bb9, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb8 (cleanup): {
|
||||
drop(_5) -> [return: bb9, unwind terminate];
|
||||
drop(_5) -> [return: bb9, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb9 (cleanup): {
|
||||
|
||||
@@ -24,7 +24,7 @@ fn std::ptr::drop_in_place(_1: *mut [String]) -> () {
|
||||
bb3 (cleanup): {
|
||||
_4 = &raw mut (*_1)[_3];
|
||||
_3 = Add(move _3, const 1_usize);
|
||||
drop((*_4)) -> [return: bb4, unwind terminate];
|
||||
drop((*_4)) -> [return: bb4, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb4 (cleanup): {
|
||||
|
||||
@@ -22,7 +22,7 @@ fn std::ptr::drop_in_place(_1: *mut Vec<i32>) -> () {
|
||||
}
|
||||
|
||||
bb4 (cleanup): {
|
||||
drop(((*_1).0: alloc::raw_vec::RawVec<i32>)) -> [return: bb2, unwind terminate];
|
||||
drop(((*_1).0: alloc::raw_vec::RawVec<i32>)) -> [return: bb2, unwind terminate(cleanup)];
|
||||
}
|
||||
|
||||
bb5: {
|
||||
|
||||
@@ -100,14 +100,17 @@ fn runtest(me: &str) {
|
||||
let s = str::from_utf8(&out.stderr).unwrap();
|
||||
// loosened the following from double::h to double:: due to
|
||||
// spurious failures on mac, 32bit, optimized
|
||||
assert!(s.contains("stack backtrace") && contains_verbose_expected(s, "double"),
|
||||
"bad output3: {}", s);
|
||||
assert!(
|
||||
s.contains("stack backtrace") &&
|
||||
s.contains("panic in a destructor during cleanup") &&
|
||||
contains_verbose_expected(s, "double"),
|
||||
"bad output3: {}", s
|
||||
);
|
||||
|
||||
// Make sure a stack trace isn't printed too many times
|
||||
//
|
||||
// Currently it is printed 3 times ("once", "twice" and "panic in a
|
||||
// function that cannot unwind") but in the future the last one may be
|
||||
// removed.
|
||||
// Currently it is printed 3 times ("once", "twice" and "panic in a destructor during
|
||||
// cleanup") but in the future the last one may be removed.
|
||||
let p = template(me).arg("double-fail")
|
||||
.env("RUST_BACKTRACE", "1").spawn().unwrap();
|
||||
let out = p.wait_with_output().unwrap();
|
||||
|
||||
22
tests/ui/panics/panic-in-cleanup.rs
Normal file
22
tests/ui/panics/panic-in-cleanup.rs
Normal file
@@ -0,0 +1,22 @@
|
||||
// run-fail
|
||||
// exec-env:RUST_BACKTRACE=0
|
||||
// check-run-results
|
||||
// error-pattern: panic in a destructor during cleanup
|
||||
// normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> ""
|
||||
// normalize-stderr-test: "\n +at [^\n]+" -> ""
|
||||
// needs-unwind
|
||||
// ignore-emscripten "RuntimeError" junk in output
|
||||
// ignore-msvc SEH doesn't do panic-during-cleanup the same way as everyone else
|
||||
|
||||
struct Bomb;
|
||||
|
||||
impl Drop for Bomb {
|
||||
fn drop(&mut self) {
|
||||
panic!("BOOM");
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let _b = Bomb;
|
||||
panic!();
|
||||
}
|
||||
10
tests/ui/panics/panic-in-cleanup.run.stderr
Normal file
10
tests/ui/panics/panic-in-cleanup.run.stderr
Normal file
@@ -0,0 +1,10 @@
|
||||
thread 'main' panicked at $DIR/panic-in-cleanup.rs:21:5:
|
||||
explicit panic
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
thread 'main' panicked at $DIR/panic-in-cleanup.rs:15:9:
|
||||
BOOM
|
||||
stack backtrace:
|
||||
thread 'main' panicked at library/core/src/panicking.rs:126:5:
|
||||
panic in a destructor during cleanup
|
||||
stack backtrace:
|
||||
thread caused non-unwinding panic. aborting.
|
||||
17
tests/ui/panics/panic-in-ffi.rs
Normal file
17
tests/ui/panics/panic-in-ffi.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
// run-fail
|
||||
// exec-env:RUST_BACKTRACE=0
|
||||
// check-run-results
|
||||
// error-pattern: panic in a function that cannot unwind
|
||||
// normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> ""
|
||||
// normalize-stderr-test: "\n +at [^\n]+" -> ""
|
||||
// needs-unwind
|
||||
// ignore-emscripten "RuntimeError" junk in output
|
||||
#![feature(c_unwind)]
|
||||
|
||||
extern "C" fn panic_in_ffi() {
|
||||
panic!("Test");
|
||||
}
|
||||
|
||||
fn main() {
|
||||
panic_in_ffi();
|
||||
}
|
||||
7
tests/ui/panics/panic-in-ffi.run.stderr
Normal file
7
tests/ui/panics/panic-in-ffi.run.stderr
Normal file
@@ -0,0 +1,7 @@
|
||||
thread 'main' panicked at $DIR/panic-in-ffi.rs:12:5:
|
||||
Test
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
thread 'main' panicked at library/core/src/panicking.rs:126:5:
|
||||
panic in a function that cannot unwind
|
||||
stack backtrace:
|
||||
thread caused non-unwinding panic. aborting.
|
||||
Reference in New Issue
Block a user