Skip to content

Commit c36614b

Browse files
committed
Auto merge of rust-lang#3906 - RalfJung:abort_unwind, r=RalfJung
add test for new abort_unwind function Seems like a good thing to have an explicit test for. Cc rust-lang#130338
2 parents 599b329 + 0332581 commit c36614b

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//@error-in-other-file: the program aborted execution
2+
//@normalize-stderr-test: "unsafe \{ libc::abort\(\) \}|crate::intrinsics::abort\(\);" -> "ABORT();"
3+
//@normalize-stderr-test: "\| +\^+" -> "| ^"
4+
//@normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> ""
5+
//@normalize-stderr-test: "\n +at [^\n]+" -> ""
6+
7+
#![feature(abort_unwind)]
8+
9+
fn main() {
10+
std::panic::abort_unwind(|| panic!("PANIC!!!"));
11+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
thread 'main' panicked at tests/fail/panic/abort_unwind.rs:LL:CC:
2+
PANIC!!!
3+
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
4+
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect
5+
thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
6+
panic in a function that cannot unwind
7+
stack backtrace:
8+
thread caused non-unwinding panic. aborting.
9+
error: abnormal termination: the program aborted execution
10+
--> RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
11+
|
12+
LL | ABORT();
13+
| ^ the program aborted execution
14+
|
15+
= note: BACKTRACE:
16+
= note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
17+
= note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
18+
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
19+
= note: inside `std::sys::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
20+
= note: inside `std::panicking::begin_panic_handler` at RUSTLIB/std/src/panicking.rs:LL:CC
21+
= note: inside `core::panicking::panic_nounwind` at RUSTLIB/core/src/panicking.rs:LL:CC
22+
= note: inside `core::panicking::panic_cannot_unwind` at RUSTLIB/core/src/panicking.rs:LL:CC
23+
= note: inside `std::panic::abort_unwind::<{closure@tests/fail/panic/abort_unwind.rs:LL:CC}, ()>` at RUSTLIB/core/src/panic.rs:LL:CC
24+
note: inside `main`
25+
--> tests/fail/panic/abort_unwind.rs:LL:CC
26+
|
27+
LL | std::panic::abort_unwind(|| panic!("PANIC!!!"));
28+
| ^
29+
30+
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
31+
32+
error: aborting due to 1 previous error
33+

0 commit comments

Comments
 (0)