Skip to content

Commit 8b951e6

Browse files
committed
normalize abort calls in miri tests
1 parent d747984 commit 8b951e6

29 files changed

+38
-36
lines changed

library/std/src/sys/pal/unix/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,10 +362,17 @@ pub fn cvt_nz(error: libc::c_int) -> crate::io::Result<()> {
362362
// multithreaded C program. It is much less severe for Rust, because Rust
363363
// stdlib doesn't use libc stdio buffering. In a typical Rust program, which
364364
// does not use C stdio, even a buggy libc::abort() is, in fact, safe.
365+
#[cfg(not(miri))]
365366
pub fn abort_internal() -> ! {
366367
unsafe { libc::abort() }
367368
}
368369

370+
#[cfg(miri)]
371+
pub fn abort_internal() -> ! {
372+
// Using the intrinsic simplifies the miri UI tests.
373+
crate::intrinsics::abort()
374+
}
375+
369376
cfg_if::cfg_if! {
370377
if #[cfg(target_os = "android")] {
371378
#[link(name = "dl", kind = "static", modifiers = "-bundle",

library/std/src/sys/pal/windows/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ pub fn abort_internal() -> ! {
353353

354354
#[cfg(miri)]
355355
pub fn abort_internal() -> ! {
356-
crate::intrinsics::abort();
356+
crate::intrinsics::abort()
357357
}
358358

359359
/// Align the inner value to 8 bytes.

src/tools/miri/tests/fail/alloc/alloc_error_handler.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//@error-in-other-file: aborted
2-
//@normalize-stderr-test: "unsafe \{ libc::abort\(\) \}|crate::intrinsics::abort\(\);" -> "ABORT();"
32
//@normalize-stderr-test: "\| +\^+" -> "| ^"
43
#![feature(allocator_api)]
54

src/tools/miri/tests/fail/alloc/alloc_error_handler.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ memory allocation of 4 bytes failed
22
error: abnormal termination: the program aborted execution
33
--> RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
44
|
5-
LL | ABORT();
5+
LL | crate::intrinsics::abort()
66
| ^ the program aborted execution
77
|
88
= note: BACKTRACE:

src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.both.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ thread caused non-unwinding panic. aborting.
1111
error: abnormal termination: the program aborted execution
1212
--> RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
1313
|
14-
LL | ABORT();
14+
LL | crate::intrinsics::abort()
1515
| ^ the program aborted execution
1616
|
1717
= note: BACKTRACE:

src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.definition.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ thread caused non-unwinding panic. aborting.
1111
error: abnormal termination: the program aborted execution
1212
--> RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
1313
|
14-
LL | ABORT();
14+
LL | crate::intrinsics::abort()
1515
| ^ the program aborted execution
1616
|
1717
= note: BACKTRACE:

src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//@revisions: extern_block definition both
2-
//@normalize-stderr-test: "unsafe \{ libc::abort\(\) \}|crate::intrinsics::abort\(\);" -> "ABORT();"
32
//@normalize-stderr-test: "\| +\^+" -> "| ^"
43
//@normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> ""
54
//@normalize-stderr-test: "\n +at [^\n]+" -> ""

src/tools/miri/tests/fail/intrinsics/uninit_uninhabited_type.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//@normalize-stderr-test: "unsafe \{ libc::abort\(\) \}|crate::intrinsics::abort\(\);" -> "ABORT();"
21
//@normalize-stderr-test: "\| +\^+" -> "| ^"
32
//@normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> ""
43
//@normalize-stderr-test: "\n +at [^\n]+" -> ""

src/tools/miri/tests/fail/intrinsics/uninit_uninhabited_type.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ thread caused non-unwinding panic. aborting.
77
error: abnormal termination: the program aborted execution
88
--> RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
99
|
10-
LL | ABORT();
10+
LL | crate::intrinsics::abort()
1111
| ^ the program aborted execution
1212
|
1313
= note: BACKTRACE:

src/tools/miri/tests/fail/intrinsics/zero_fn_ptr.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//@normalize-stderr-test: "unsafe \{ libc::abort\(\) \}|crate::intrinsics::abort\(\);" -> "ABORT();"
21
//@normalize-stderr-test: "\| +\^+" -> "| ^"
32
//@normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> ""
43
//@normalize-stderr-test: "\n +at [^\n]+" -> ""

0 commit comments

Comments
 (0)