Skip to content

Commit acd9ba5

Browse files
Rollup merge of #146118 - RalfJung:miri-abort, r=joboet
improve process::abort rendering in Miri backtraces Also, avoid using the `sys` function directly in the panic machinery -- that seems like an unnecessary layering violation.
2 parents 56d7738 + 81b026e commit acd9ba5

24 files changed

+49
-88
lines changed

tests/fail/alloc/alloc_error_handler.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
//@error-in-other-file: aborted
2-
//@normalize-stderr-test: "\|.*::abort\(\).*" -> "| ABORT()"
3-
//@normalize-stderr-test: "\| +\^+" -> "| ^"
42
#![feature(allocator_api)]
53

64
use std::alloc::*;

tests/fail/alloc/alloc_error_handler.stderr

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
memory allocation of 4 bytes failed
22
error: abnormal termination: the program aborted execution
3-
--> RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
3+
--> RUSTLIB/std/src/alloc.rs:LL:CC
44
|
5-
LL | ABORT()
6-
| ^ abnormal termination occurred here
5+
LL | crate::process::abort()
6+
| ^^^^^^^^^^^^^^^^^^^^^^^ abnormal termination occurred here
77
|
88
= note: BACKTRACE:
9-
= note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
10-
= note: inside `std::process::abort` at RUSTLIB/std/src/process.rs:LL:CC
119
= note: inside `std::alloc::rust_oom` at RUSTLIB/std/src/alloc.rs:LL:CC
1210
= note: inside `std::alloc::_::__rg_oom` at RUSTLIB/std/src/alloc.rs:LL:CC
1311
= note: inside `std::alloc::handle_alloc_error::rt_error` at RUSTLIB/alloc/src/alloc.rs:LL:CC
@@ -16,7 +14,7 @@ note: inside `main`
1614
--> tests/fail/alloc/alloc_error_handler.rs:LL:CC
1715
|
1816
LL | handle_alloc_error(Layout::for_value(&0));
19-
| ^
17+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2018

2119
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
2220

tests/fail/function_calls/exported_symbol_bad_unwind2.both.stderr

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@ panic in a function that cannot unwind
99
stack backtrace:
1010
thread caused non-unwinding panic. aborting.
1111
error: abnormal termination: the program aborted execution
12-
--> RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
12+
--> RUSTLIB/std/src/panicking.rs:LL:CC
1313
|
14-
LL | ABORT()
15-
| ^ abnormal termination occurred here
14+
LL | crate::process::abort();
15+
| ^^^^^^^^^^^^^^^^^^^^^^^ abnormal termination occurred here
1616
|
1717
= note: BACKTRACE:
18-
= note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
1918
= note: inside `std::panicking::panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
2019
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
2120
= note: inside `std::sys::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
@@ -33,7 +32,7 @@ note: inside `main`
3332
--> tests/fail/function_calls/exported_symbol_bad_unwind2.rs:LL:CC
3433
|
3534
LL | unsafe { nounwind() }
36-
| ^
35+
| ^^^^^^^^^^
3736

3837
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
3938

tests/fail/function_calls/exported_symbol_bad_unwind2.definition.stderr

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@ panic in a function that cannot unwind
99
stack backtrace:
1010
thread caused non-unwinding panic. aborting.
1111
error: abnormal termination: the program aborted execution
12-
--> RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
12+
--> RUSTLIB/std/src/panicking.rs:LL:CC
1313
|
14-
LL | ABORT()
15-
| ^ abnormal termination occurred here
14+
LL | crate::process::abort();
15+
| ^^^^^^^^^^^^^^^^^^^^^^^ abnormal termination occurred here
1616
|
1717
= note: BACKTRACE:
18-
= note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
1918
= note: inside `std::panicking::panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
2019
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
2120
= note: inside `std::sys::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
@@ -33,7 +32,7 @@ note: inside `main`
3332
--> tests/fail/function_calls/exported_symbol_bad_unwind2.rs:LL:CC
3433
|
3534
LL | unsafe { nounwind() }
36-
| ^
35+
| ^^^^^^^^^^
3736

3837
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
3938

tests/fail/function_calls/exported_symbol_bad_unwind2.extern_block.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ error: Undefined Behavior: unwinding past a stack frame that does not allow unwi
77
--> tests/fail/function_calls/exported_symbol_bad_unwind2.rs:LL:CC
88
|
99
LL | unsafe { nounwind() }
10-
| ^ Undefined Behavior occurred here
10+
| ^^^^^^^^^^ Undefined Behavior occurred here
1111
|
1212
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
1313
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/fail/function_calls/exported_symbol_bad_unwind2.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
//@revisions: extern_block definition both
2-
//@normalize-stderr-test: "\|.*::abort\(\).*" -> "| ABORT()"
3-
//@normalize-stderr-test: "\| +\^+" -> "| ^"
42
//@normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> ""
53
//@normalize-stderr-test: "\n +at [^\n]+" -> ""
64
//@[definition,both]error-in-other-file: aborted execution

tests/fail/panic/abort_unwind.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
//@error-in-other-file: the program aborted execution
2-
//@normalize-stderr-test: "\|.*::abort\(\).*" -> "| ABORT()"
3-
//@normalize-stderr-test: "\| +\^+" -> "| ^"
42
//@normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> ""
53
//@normalize-stderr-test: "\n +at [^\n]+" -> ""
64

tests/fail/panic/abort_unwind.stderr

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@ panic in a function that cannot unwind
99
stack backtrace:
1010
thread caused non-unwinding panic. aborting.
1111
error: abnormal termination: the program aborted execution
12-
--> RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
12+
--> RUSTLIB/std/src/panicking.rs:LL:CC
1313
|
14-
LL | ABORT()
15-
| ^ abnormal termination occurred here
14+
LL | crate::process::abort();
15+
| ^^^^^^^^^^^^^^^^^^^^^^^ abnormal termination occurred here
1616
|
1717
= note: BACKTRACE:
18-
= note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
1918
= note: inside `std::panicking::panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
2019
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
2120
= note: inside `std::sys::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
@@ -27,7 +26,7 @@ note: inside `main`
2726
--> tests/fail/panic/abort_unwind.rs:LL:CC
2827
|
2928
LL | std::panic::abort_unwind(|| panic!("PANIC!!!"));
30-
| ^
29+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3130

3231
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
3332

tests/fail/panic/double_panic.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//@normalize-stderr-test: "\|.*::abort\(\).*" -> "| ABORT()"
2-
//@normalize-stderr-test: "\| +\^+" -> "| ^"
31
//@normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> ""
42
//@normalize-stderr-test: "\n +at [^\n]+" -> ""
53
//@error-in-other-file: aborted execution

tests/fail/panic/double_panic.stderr

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@ thread 'main' ($TID) panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
1212
panic in a destructor during cleanup
1313
thread caused non-unwinding panic. aborting.
1414
error: abnormal termination: the program aborted execution
15-
--> RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
15+
--> RUSTLIB/std/src/panicking.rs:LL:CC
1616
|
17-
LL | ABORT()
18-
| ^ abnormal termination occurred here
17+
LL | crate::process::abort();
18+
| ^^^^^^^^^^^^^^^^^^^^^^^ abnormal termination occurred here
1919
|
2020
= note: BACKTRACE:
21-
= note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
2221
= note: inside `std::panicking::panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
2322
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
2423
= note: inside `std::sys::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys/backtrace.rs:LL:CC

0 commit comments

Comments
 (0)