Fix tests for C-unwind ABI changes

This commit is contained in:
hyd-dev 2021-08-05 17:10:30 +08:00
parent 3ca53e0307
commit af7eb369b1
No known key found for this signature in database
GPG key ID: 74FA7FD5B8DA14B8
9 changed files with 10 additions and 53 deletions

View file

@ -1 +1 @@
71ff9b41e9ebd3e336019513917a7a8868d1cc66
996ff2e0a0f911f52bb1de6bdd0cfd5704de1fc9

View file

@ -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();

View file

@ -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
}

View file

@ -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
}

View file

@ -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) -> !;

View file

@ -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();
}

View file

@ -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

View file

@ -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() }
}

View file

@ -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