From af7eb369b1eef147032e570d81dfc5c4e341b0ea Mon Sep 17 00:00:00 2001 From: hyd-dev Date: Thu, 5 Aug 2021 17:10:30 +0800 Subject: [PATCH] Fix tests for `C-unwind` ABI changes --- rust-version | 2 +- tests/compile-fail/abort-terminator.rs | 5 ++--- .../function_calls/exported_symbol_bad_unwind2.rs | 4 ++-- .../function_calls/exported_symbol_bad_unwind3.rs | 15 --------------- tests/compile-fail/panic/bad_miri_start_panic.rs | 2 ++ .../function_calls/exported_symbol_good_unwind.rs | 13 +------------ .../exported_symbol_good_unwind.stderr | 5 ++--- .../exported_symbol_unwind_allowed.rs | 15 --------------- .../exported_symbol_unwind_allowed.stderr | 2 -- 9 files changed, 10 insertions(+), 53 deletions(-) delete mode 100644 tests/compile-fail/function_calls/exported_symbol_bad_unwind3.rs delete mode 100644 tests/run-pass/function_calls/exported_symbol_unwind_allowed.rs delete mode 100644 tests/run-pass/function_calls/exported_symbol_unwind_allowed.stderr diff --git a/rust-version b/rust-version index c8725ea022..e40ae69e28 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -71ff9b41e9ebd3e336019513917a7a8868d1cc66 +996ff2e0a0f911f52bb1de6bdd0cfd5704de1fc9 diff --git a/tests/compile-fail/abort-terminator.rs b/tests/compile-fail/abort-terminator.rs index 73286a1759..8e6e2a7660 100644 --- a/tests/compile-fail/abort-terminator.rs +++ b/tests/compile-fail/abort-terminator.rs @@ -1,8 +1,7 @@ // error-pattern: the program aborted -#![feature(unwind_attributes)] +#![feature(c_unwind)] -#[unwind(aborts)] -fn panic_abort() { panic!() } +extern "C" fn panic_abort() { panic!() } fn main() { panic_abort(); diff --git a/tests/compile-fail/function_calls/exported_symbol_bad_unwind2.rs b/tests/compile-fail/function_calls/exported_symbol_bad_unwind2.rs index 85cca8f1a6..e80a79d102 100644 --- a/tests/compile-fail/function_calls/exported_symbol_bad_unwind2.rs +++ b/tests/compile-fail/function_calls/exported_symbol_bad_unwind2.rs @@ -4,6 +4,8 @@ #[cfg_attr(any(definition, both), rustc_allocator_nounwind)] #[no_mangle] extern "C-unwind" fn nounwind() { + //[definition]~^ ERROR abnormal termination: the program aborted execution + //[both]~^^ ERROR abnormal termination: the program aborted execution panic!(); } @@ -14,6 +16,4 @@ fn main() { } unsafe { nounwind() } //[extern_block]~^ ERROR unwinding past a stack frame that does not allow unwinding - //[definition]~^^ ERROR unwinding past a stack frame that does not allow unwinding - //[both]~^^^ ERROR unwinding past a stack frame that does not allow unwinding } diff --git a/tests/compile-fail/function_calls/exported_symbol_bad_unwind3.rs b/tests/compile-fail/function_calls/exported_symbol_bad_unwind3.rs deleted file mode 100644 index bbbe677d36..0000000000 --- a/tests/compile-fail/function_calls/exported_symbol_bad_unwind3.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![feature(unwind_attributes)] - -#[unwind(allowed)] -#[no_mangle] -extern "C" fn unwind() { - panic!(); -} - -fn main() { - extern "C" { - fn unwind(); - } - unsafe { unwind() } - //~^ ERROR unwinding past a stack frame that does not allow unwinding -} diff --git a/tests/compile-fail/panic/bad_miri_start_panic.rs b/tests/compile-fail/panic/bad_miri_start_panic.rs index f77f892abc..089cd86f1b 100644 --- a/tests/compile-fail/panic/bad_miri_start_panic.rs +++ b/tests/compile-fail/panic/bad_miri_start_panic.rs @@ -1,4 +1,6 @@ // compile-flags: -Zmiri-disable-abi-check +// This feature is required to trigger the error using the "C" ABI. +#![feature(c_unwind)] extern "C" { fn miri_start_panic(payload: *mut u8) -> !; diff --git a/tests/run-pass/function_calls/exported_symbol_good_unwind.rs b/tests/run-pass/function_calls/exported_symbol_good_unwind.rs index 3dd3b8f22d..71b799a1f1 100644 --- a/tests/run-pass/function_calls/exported_symbol_good_unwind.rs +++ b/tests/run-pass/function_calls/exported_symbol_good_unwind.rs @@ -2,16 +2,10 @@ // found in this form" errors works without `-C prefer-dynamic` (`panic!` calls foreign function // `__rust_start_panic`). // no-prefer-dynamic -#![feature(c_unwind, unboxed_closures, unwind_attributes)] +#![feature(c_unwind, unboxed_closures)] use std::panic; -#[no_mangle] -#[unwind(allowed)] -extern "C" fn good_unwind_allowed() { - panic!(); -} - #[no_mangle] extern "C-unwind" fn good_unwind_c() { panic!(); @@ -29,11 +23,6 @@ extern "rust-call" fn good_unwind_rust_call(_: ()) -> ! { } fn main() -> ! { - extern "C" { - #[unwind(allowed)] - fn good_unwind_allowed(); - } - panic::catch_unwind(|| unsafe { good_unwind_allowed() }).unwrap_err(); extern "C-unwind" { fn good_unwind_c(); } diff --git a/tests/run-pass/function_calls/exported_symbol_good_unwind.stderr b/tests/run-pass/function_calls/exported_symbol_good_unwind.stderr index 3347f00b65..40a8f39509 100644 --- a/tests/run-pass/function_calls/exported_symbol_good_unwind.stderr +++ b/tests/run-pass/function_calls/exported_symbol_good_unwind.stderr @@ -1,5 +1,4 @@ -thread 'main' panicked at 'explicit panic', $DIR/exported_symbol_good_unwind.rs:12:5 +thread 'main' panicked at 'explicit panic', $DIR/exported_symbol_good_unwind.rs:11:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace -thread 'main' panicked at 'explicit panic', $DIR/exported_symbol_good_unwind.rs:17:5 +thread 'main' panicked at 'explicit panic', $DIR/exported_symbol_good_unwind.rs:16:5 thread 'main' panicked at 'explicit panic', $DIR/exported_symbol_good_unwind.rs:22:5 -thread 'main' panicked at 'explicit panic', $DIR/exported_symbol_good_unwind.rs:28:5 diff --git a/tests/run-pass/function_calls/exported_symbol_unwind_allowed.rs b/tests/run-pass/function_calls/exported_symbol_unwind_allowed.rs deleted file mode 100644 index 0e4ec5739a..0000000000 --- a/tests/run-pass/function_calls/exported_symbol_unwind_allowed.rs +++ /dev/null @@ -1,15 +0,0 @@ -// compile-flags: -Zmiri-disable-abi-check -#![feature(unwind_attributes, c_unwind)] - -#[no_mangle] -extern "C-unwind" fn unwind() { - panic!(); -} - -fn main() { - extern "C" { - #[unwind(allowed)] - fn unwind(); - } - unsafe { unwind() } -} diff --git a/tests/run-pass/function_calls/exported_symbol_unwind_allowed.stderr b/tests/run-pass/function_calls/exported_symbol_unwind_allowed.stderr deleted file mode 100644 index 14ee43950c..0000000000 --- a/tests/run-pass/function_calls/exported_symbol_unwind_allowed.stderr +++ /dev/null @@ -1,2 +0,0 @@ -thread 'main' panicked at 'explicit panic', $DIR/exported_symbol_unwind_allowed.rs:6:5 -note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace