diff options
Diffstat (limited to 'tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/panic.rs')
-rw-r--r-- | tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/panic.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/panic.rs b/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/panic.rs new file mode 100644 index 000000000..a99a04d5c --- /dev/null +++ b/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/panic.rs @@ -0,0 +1,12 @@ +#![crate_type = "staticlib"] +#![feature(c_unwind)] + +/// This function will panic if `x` is greater than 10. +/// +/// This function is called by `add_small_numbers`. +#[no_mangle] +pub extern "C-unwind" fn panic_if_greater_than_10(x: u32) { + if x > 10 { + panic!("{}", x); // That is too big! + } +} |