Skip to content

Commit daf3063

Browse files
committed
Add test case for foreign Rust exceptions
1 parent 86c65d2 commit daf3063

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
include ../tools.mk
2+
3+
all:
4+
$(RUSTC) bar.rs --crate-type=cdylib
5+
$(RUSTC) foo.rs
6+
$(call RUN,foo) 2>&1 | $(CGREP) "Rust cannot catch foreign exceptions"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#![crate_type = "cdylib"]
2+
#![feature(c_unwind)]
3+
4+
#[no_mangle]
5+
extern "C-unwind" fn panic() {
6+
panic!();
7+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#![feature(c_unwind)]
2+
3+
#[link(name = "bar")]
4+
extern "C-unwind" {
5+
fn panic();
6+
}
7+
8+
fn main() {
9+
let _ = std::panic::catch_unwind(|| {
10+
unsafe { panic() };
11+
});
12+
}

0 commit comments

Comments
 (0)