]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/try-panic-abort.rs
Rollup merge of #70038 - DutchGhost:const-forget-tests, r=RalfJung
[rust.git] / src / test / codegen / try-panic-abort.rs
1 // compile-flags: -C panic=abort -O
2
3 #![crate_type = "lib"]
4 #![feature(unwind_attributes, core_intrinsics)]
5
6 extern "C" {
7     #[unwind(allow)]
8     fn bar(data: *mut u8);
9 }
10 extern "Rust" {
11     fn catch(data: *mut u8, exception: *mut u8);
12 }
13
14 // CHECK-LABEL: @foo
15 #[no_mangle]
16 pub unsafe fn foo() -> i32 {
17     // CHECK: call void @bar
18     // CHECK: ret i32 0
19     std::intrinsics::r#try(|x| bar(x), 0 as *mut u8, |x, y| catch(x, y))
20 }