about summary refs log tree commit diff
path: root/src/test/codegen/try-panic-abort.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/codegen/try-panic-abort.rs')
-rw-r--r--src/test/codegen/try-panic-abort.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/codegen/try-panic-abort.rs b/src/test/codegen/try-panic-abort.rs
new file mode 100644
index 00000000000..166d2bb9942
--- /dev/null
+++ b/src/test/codegen/try-panic-abort.rs
@@ -0,0 +1,20 @@
+// compile-flags: -C panic=abort -O
+
+#![crate_type = "lib"]
+#![feature(unwind_attributes, core_intrinsics)]
+
+extern "C" {
+    #[unwind(allow)]
+    fn bar(data: *mut u8);
+}
+extern "Rust" {
+    fn catch(data: *mut u8, exception: *mut u8);
+}
+
+// CHECK-LABEL: @foo
+#[no_mangle]
+pub unsafe fn foo() -> i32 {
+    // CHECK: call void @bar
+    // CHECK: ret i32 0
+    std::intrinsics::r#try(|x| bar(x), 0 as *mut u8, |x, y| catch(x, y))
+}