Skip to content

Commit eb4caf1

Browse files
committed
Add test case for foreign Rust exceptions
1 parent 6930869 commit eb4caf1

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed
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"
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+
}
+12
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)