From 8997db2ec99d980e827f8bb4ed212dce1d5e7e02 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 31 May 2022 19:00:14 -0400 Subject: [PATCH] paper over platform differences --- tests/compile-fail/alloc/global_system_mixup.rs | 2 ++ tests/compile-fail/alloc/global_system_mixup.stderr | 6 +++--- tests/compile-fail/panic/double_panic.rs | 2 ++ tests/compile-fail/panic/double_panic.stderr | 6 +++--- tests/compile-fail/panic/panic_abort1.rs | 2 ++ tests/compile-fail/panic/panic_abort1.stderr | 6 +++--- tests/compile-fail/panic/panic_abort2.rs | 2 ++ tests/compile-fail/panic/panic_abort2.stderr | 6 +++--- tests/compile-fail/panic/panic_abort3.rs | 2 ++ tests/compile-fail/panic/panic_abort3.stderr | 6 +++--- tests/compile-fail/panic/panic_abort4.rs | 2 ++ tests/compile-fail/panic/panic_abort4.stderr | 6 +++--- 12 files changed, 30 insertions(+), 18 deletions(-) diff --git a/tests/compile-fail/alloc/global_system_mixup.rs b/tests/compile-fail/alloc/global_system_mixup.rs index 3f58de4d6fb0..bb87b132f322 100644 --- a/tests/compile-fail/alloc/global_system_mixup.rs +++ b/tests/compile-fail/alloc/global_system_mixup.rs @@ -3,6 +3,8 @@ // error-pattern: which is Rust heap memory, using // normalize-stderr-test: "using [A-Za-z]+ heap deallocation operation" -> "using PLATFORM heap deallocation operation" +// normalize-stderr-test: "\| +\^+" -> "| ^" +// normalize-stderr-test: "libc::free\([^()]*\)|unsafe \{ HeapFree\([^()]*\) \};" -> "FREE();" #![feature(allocator_api, slice_ptr_get)] diff --git a/tests/compile-fail/alloc/global_system_mixup.stderr b/tests/compile-fail/alloc/global_system_mixup.stderr index 84d68be78cd1..a3b9009e3035 100644 --- a/tests/compile-fail/alloc/global_system_mixup.stderr +++ b/tests/compile-fail/alloc/global_system_mixup.stderr @@ -1,8 +1,8 @@ error: Undefined Behavior: deallocating ALLOC, which is Rust heap memory, using PLATFORM heap deallocation operation --> RUSTLIB/std/src/sys/PLATFORM/alloc.rs:LL:CC | -LL | libc::free(ptr as *mut libc::c_void) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocating ALLOC, which is Rust heap memory, using PLATFORM heap deallocation operation +LL | FREE(); + | ^ deallocating ALLOC, which is Rust heap memory, using PLATFORM heap deallocation operation | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information @@ -13,7 +13,7 @@ note: inside `main` at $DIR/global_system_mixup.rs:LL:CC --> $DIR/global_system_mixup.rs:LL:CC | LL | unsafe { System.deallocate(ptr, l); } - | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/compile-fail/panic/double_panic.rs b/tests/compile-fail/panic/double_panic.rs index 670c037988c2..f3af66a79abc 100644 --- a/tests/compile-fail/panic/double_panic.rs +++ b/tests/compile-fail/panic/double_panic.rs @@ -1,4 +1,6 @@ // error-pattern: the program aborted +// normalize-stderr-test: "\| +\^+" -> "| ^" +// normalize-stderr-test: "unsafe \{ libc::abort\(\) \}|crate::intrinsics::abort\(\);" -> "ABORT();" struct Foo; impl Drop for Foo { diff --git a/tests/compile-fail/panic/double_panic.stderr b/tests/compile-fail/panic/double_panic.stderr index 9cdba65c0a82..0dbd68c0984f 100644 --- a/tests/compile-fail/panic/double_panic.stderr +++ b/tests/compile-fail/panic/double_panic.stderr @@ -68,8 +68,8 @@ thread panicked while panicking. aborting. error: abnormal termination: the program aborted execution --> RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC | -LL | unsafe { libc::abort() } - | ^^^^^^^^^^^^^ the program aborted execution +LL | ABORT(); + | ^ the program aborted execution | = note: inside `std::sys::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC = note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC @@ -80,7 +80,7 @@ note: inside `::drop` at RUSTLIB/std/src/panic.rs:LL:CC --> $DIR/double_panic.rs:LL:CC | LL | panic!("second"); - | ^^^^^^^^^^^^^^^^ + | ^ = note: inside `std::ptr::drop_in_place:: - shim(Some(Foo))` at RUSTLIB/core/src/ptr/mod.rs:LL:CC note: inside `main` at $DIR/double_panic.rs:LL:CC --> $DIR/double_panic.rs:LL:CC diff --git a/tests/compile-fail/panic/panic_abort1.rs b/tests/compile-fail/panic/panic_abort1.rs index 095d9e3d75b0..9c094c659837 100644 --- a/tests/compile-fail/panic/panic_abort1.rs +++ b/tests/compile-fail/panic/panic_abort1.rs @@ -1,4 +1,6 @@ // error-pattern: the program aborted execution +// normalize-stderr-test: "\| +\^+" -> "| ^" +// normalize-stderr-test: "libc::abort\(\);|core::intrinsics::abort\(\);" -> "ABORT();" // compile-flags: -C panic=abort fn main() { diff --git a/tests/compile-fail/panic/panic_abort1.stderr b/tests/compile-fail/panic/panic_abort1.stderr index 79e1f29ef8aa..9610a161280a 100644 --- a/tests/compile-fail/panic/panic_abort1.stderr +++ b/tests/compile-fail/panic/panic_abort1.stderr @@ -3,8 +3,8 @@ note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace error: abnormal termination: the program aborted execution --> RUSTLIB/panic_abort/src/lib.rs:LL:CC | -LL | libc::abort(); - | ^^^^^^^^^^^^^ the program aborted execution +LL | ABORT(); + | ^ the program aborted execution | = note: inside `panic_abort::__rust_start_panic::abort` at RUSTLIB/panic_abort/src/lib.rs:LL:CC = note: inside `panic_abort::__rust_start_panic` at RUSTLIB/panic_abort/src/lib.rs:LL:CC @@ -17,7 +17,7 @@ note: inside `main` at RUSTLIB/std/src/panic.rs:LL:CC --> $DIR/panic_abort1.rs:LL:CC | LL | std::panic!("panicking from libstd"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/compile-fail/panic/panic_abort2.rs b/tests/compile-fail/panic/panic_abort2.rs index de177bc4e716..7eb9a3c24aa2 100644 --- a/tests/compile-fail/panic/panic_abort2.rs +++ b/tests/compile-fail/panic/panic_abort2.rs @@ -1,4 +1,6 @@ // error-pattern: the program aborted execution +// normalize-stderr-test: "\| +\^+" -> "| ^" +// normalize-stderr-test: "libc::abort\(\);|core::intrinsics::abort\(\);" -> "ABORT();" // compile-flags: -C panic=abort fn main() { diff --git a/tests/compile-fail/panic/panic_abort2.stderr b/tests/compile-fail/panic/panic_abort2.stderr index 3cd08ab645e8..0c446323a779 100644 --- a/tests/compile-fail/panic/panic_abort2.stderr +++ b/tests/compile-fail/panic/panic_abort2.stderr @@ -3,8 +3,8 @@ note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace error: abnormal termination: the program aborted execution --> RUSTLIB/panic_abort/src/lib.rs:LL:CC | -LL | libc::abort(); - | ^^^^^^^^^^^^^ the program aborted execution +LL | ABORT(); + | ^ the program aborted execution | = note: inside `panic_abort::__rust_start_panic::abort` at RUSTLIB/panic_abort/src/lib.rs:LL:CC = note: inside `panic_abort::__rust_start_panic` at RUSTLIB/panic_abort/src/lib.rs:LL:CC @@ -18,7 +18,7 @@ note: inside `main` at RUSTLIB/std/src/panic.rs:LL:CC --> $DIR/panic_abort2.rs:LL:CC | LL | std::panic!("{}-panicking from libstd", 42); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/compile-fail/panic/panic_abort3.rs b/tests/compile-fail/panic/panic_abort3.rs index 2d65da4fe341..1940b48bad78 100644 --- a/tests/compile-fail/panic/panic_abort3.rs +++ b/tests/compile-fail/panic/panic_abort3.rs @@ -1,4 +1,6 @@ // error-pattern: the program aborted execution +// normalize-stderr-test: "\| +\^+" -> "| ^" +// normalize-stderr-test: "libc::abort\(\);|core::intrinsics::abort\(\);" -> "ABORT();" // compile-flags: -C panic=abort fn main() { diff --git a/tests/compile-fail/panic/panic_abort3.stderr b/tests/compile-fail/panic/panic_abort3.stderr index f6e8b16df961..2d7b576372e0 100644 --- a/tests/compile-fail/panic/panic_abort3.stderr +++ b/tests/compile-fail/panic/panic_abort3.stderr @@ -3,8 +3,8 @@ note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace error: abnormal termination: the program aborted execution --> RUSTLIB/panic_abort/src/lib.rs:LL:CC | -LL | libc::abort(); - | ^^^^^^^^^^^^^ the program aborted execution +LL | ABORT(); + | ^ the program aborted execution | = note: inside `panic_abort::__rust_start_panic::abort` at RUSTLIB/panic_abort/src/lib.rs:LL:CC = note: inside `panic_abort::__rust_start_panic` at RUSTLIB/panic_abort/src/lib.rs:LL:CC @@ -19,7 +19,7 @@ note: inside `main` at RUSTLIB/core/src/panic.rs:LL:CC --> $DIR/panic_abort3.rs:LL:CC | LL | core::panic!("panicking from libcore"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/compile-fail/panic/panic_abort4.rs b/tests/compile-fail/panic/panic_abort4.rs index 41d32a604fed..e5190ea0765d 100644 --- a/tests/compile-fail/panic/panic_abort4.rs +++ b/tests/compile-fail/panic/panic_abort4.rs @@ -1,4 +1,6 @@ // error-pattern: the program aborted execution +// normalize-stderr-test: "\| +\^+" -> "| ^" +// normalize-stderr-test: "libc::abort\(\);|core::intrinsics::abort\(\);" -> "ABORT();" // compile-flags: -C panic=abort fn main() { diff --git a/tests/compile-fail/panic/panic_abort4.stderr b/tests/compile-fail/panic/panic_abort4.stderr index 39fe03a2e027..b0b11248104d 100644 --- a/tests/compile-fail/panic/panic_abort4.stderr +++ b/tests/compile-fail/panic/panic_abort4.stderr @@ -3,8 +3,8 @@ note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace error: abnormal termination: the program aborted execution --> RUSTLIB/panic_abort/src/lib.rs:LL:CC | -LL | libc::abort(); - | ^^^^^^^^^^^^^ the program aborted execution +LL | ABORT(); + | ^ the program aborted execution | = note: inside `panic_abort::__rust_start_panic::abort` at RUSTLIB/panic_abort/src/lib.rs:LL:CC = note: inside `panic_abort::__rust_start_panic` at RUSTLIB/panic_abort/src/lib.rs:LL:CC @@ -18,7 +18,7 @@ note: inside `main` at RUSTLIB/core/src/panic.rs:LL:CC --> $DIR/panic_abort4.rs:LL:CC | LL | core::panic!("{}-panicking from libcore", 42); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace