diff options
Diffstat (limited to 'tests/ui/panic-runtime/auxiliary')
11 files changed, 127 insertions, 0 deletions
diff --git a/tests/ui/panic-runtime/auxiliary/depends.rs b/tests/ui/panic-runtime/auxiliary/depends.rs new file mode 100644 index 000000000..e9bc2f489 --- /dev/null +++ b/tests/ui/panic-runtime/auxiliary/depends.rs @@ -0,0 +1,8 @@ +// no-prefer-dynamic + +#![feature(panic_runtime)] +#![crate_type = "rlib"] +#![panic_runtime] +#![no_std] + +extern crate needs_panic_runtime; diff --git a/tests/ui/panic-runtime/auxiliary/exit-success-if-unwind.rs b/tests/ui/panic-runtime/auxiliary/exit-success-if-unwind.rs new file mode 100644 index 000000000..c0e057405 --- /dev/null +++ b/tests/ui/panic-runtime/auxiliary/exit-success-if-unwind.rs @@ -0,0 +1,16 @@ +// no-prefer-dynamic + +#![crate_type = "rlib"] + +struct Bomb; + +impl Drop for Bomb { + fn drop(&mut self) { + std::process::exit(0); + } +} + +pub fn bar(f: fn()) { + let _bomb = Bomb; + f(); +} diff --git a/tests/ui/panic-runtime/auxiliary/needs-abort.rs b/tests/ui/panic-runtime/auxiliary/needs-abort.rs new file mode 100644 index 000000000..8fad49b5e --- /dev/null +++ b/tests/ui/panic-runtime/auxiliary/needs-abort.rs @@ -0,0 +1,5 @@ +// compile-flags:-C panic=abort +// no-prefer-dynamic + +#![crate_type = "rlib"] +#![no_std] diff --git a/tests/ui/panic-runtime/auxiliary/needs-panic-runtime.rs b/tests/ui/panic-runtime/auxiliary/needs-panic-runtime.rs new file mode 100644 index 000000000..3f030c169 --- /dev/null +++ b/tests/ui/panic-runtime/auxiliary/needs-panic-runtime.rs @@ -0,0 +1,6 @@ +// no-prefer-dynamic + +#![feature(needs_panic_runtime)] +#![crate_type = "rlib"] +#![needs_panic_runtime] +#![no_std] diff --git a/tests/ui/panic-runtime/auxiliary/needs-unwind.rs b/tests/ui/panic-runtime/auxiliary/needs-unwind.rs new file mode 100644 index 000000000..d555b5319 --- /dev/null +++ b/tests/ui/panic-runtime/auxiliary/needs-unwind.rs @@ -0,0 +1,13 @@ +// compile-flags:-C panic=unwind +// no-prefer-dynamic + +#![crate_type = "rlib"] +#![no_std] +#![feature(c_unwind)] + +extern "C-unwind" fn foo() {} + +fn bar() { + let ptr: extern "C-unwind" fn() = foo; + ptr(); +} diff --git a/tests/ui/panic-runtime/auxiliary/panic-runtime-abort.rs b/tests/ui/panic-runtime/auxiliary/panic-runtime-abort.rs new file mode 100644 index 000000000..c92015eee --- /dev/null +++ b/tests/ui/panic-runtime/auxiliary/panic-runtime-abort.rs @@ -0,0 +1,17 @@ +// compile-flags:-C panic=abort +// no-prefer-dynamic + +#![feature(panic_runtime)] +#![crate_type = "rlib"] + +#![no_std] +#![panic_runtime] + +#[no_mangle] +pub extern "C" fn __rust_maybe_catch_panic() {} + +#[no_mangle] +pub extern "C" fn __rust_start_panic() {} + +#[no_mangle] +pub extern "C" fn rust_eh_personality() {} diff --git a/tests/ui/panic-runtime/auxiliary/panic-runtime-lang-items.rs b/tests/ui/panic-runtime/auxiliary/panic-runtime-lang-items.rs new file mode 100644 index 000000000..b9ef2f329 --- /dev/null +++ b/tests/ui/panic-runtime/auxiliary/panic-runtime-lang-items.rs @@ -0,0 +1,15 @@ +// no-prefer-dynamic + +#![crate_type = "rlib"] + +#![no_std] +#![feature(lang_items)] + +use core::panic::PanicInfo; + +#[lang = "panic_impl"] +fn panic_impl(info: &PanicInfo) -> ! { loop {} } +#[lang = "eh_personality"] +fn eh_personality() {} +#[lang = "eh_catch_typeinfo"] +static EH_CATCH_TYPEINFO: u8 = 0; diff --git a/tests/ui/panic-runtime/auxiliary/panic-runtime-unwind.rs b/tests/ui/panic-runtime/auxiliary/panic-runtime-unwind.rs new file mode 100644 index 000000000..2f7aed924 --- /dev/null +++ b/tests/ui/panic-runtime/auxiliary/panic-runtime-unwind.rs @@ -0,0 +1,17 @@ +// compile-flags:-C panic=unwind +// no-prefer-dynamic + +#![feature(panic_runtime)] +#![crate_type = "rlib"] + +#![no_std] +#![panic_runtime] + +#[no_mangle] +pub extern "C" fn __rust_maybe_catch_panic() {} + +#[no_mangle] +pub extern "C" fn __rust_start_panic() {} + +#[no_mangle] +pub extern "C" fn rust_eh_personality() {} diff --git a/tests/ui/panic-runtime/auxiliary/panic-runtime-unwind2.rs b/tests/ui/panic-runtime/auxiliary/panic-runtime-unwind2.rs new file mode 100644 index 000000000..2f7aed924 --- /dev/null +++ b/tests/ui/panic-runtime/auxiliary/panic-runtime-unwind2.rs @@ -0,0 +1,17 @@ +// compile-flags:-C panic=unwind +// no-prefer-dynamic + +#![feature(panic_runtime)] +#![crate_type = "rlib"] + +#![no_std] +#![panic_runtime] + +#[no_mangle] +pub extern "C" fn __rust_maybe_catch_panic() {} + +#[no_mangle] +pub extern "C" fn __rust_start_panic() {} + +#[no_mangle] +pub extern "C" fn rust_eh_personality() {} diff --git a/tests/ui/panic-runtime/auxiliary/wants-panic-runtime-abort.rs b/tests/ui/panic-runtime/auxiliary/wants-panic-runtime-abort.rs new file mode 100644 index 000000000..3c0d2d658 --- /dev/null +++ b/tests/ui/panic-runtime/auxiliary/wants-panic-runtime-abort.rs @@ -0,0 +1,7 @@ +// compile-flags:-C panic=abort +// no-prefer-dynamic + +#![crate_type = "rlib"] +#![no_std] + +extern crate panic_runtime_abort; diff --git a/tests/ui/panic-runtime/auxiliary/wants-panic-runtime-unwind.rs b/tests/ui/panic-runtime/auxiliary/wants-panic-runtime-unwind.rs new file mode 100644 index 000000000..d5f010219 --- /dev/null +++ b/tests/ui/panic-runtime/auxiliary/wants-panic-runtime-unwind.rs @@ -0,0 +1,6 @@ +// no-prefer-dynamic + +#![crate_type = "rlib"] +#![no_std] + +extern crate panic_runtime_unwind; |