forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#102721 - nbdd0121:panic, r=Amanieu
Prevent foreign Rust exceptions from being caught Fix rust-lang#102715 Use the address of a static variable (which is guaranteed to be unique per copy of std) to tell apart if a Rust exception comes from local or foreign Rust code, and abort for the latter.
- Loading branch information
Showing
6 changed files
with
96 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
include ../tools.mk | ||
|
||
all: | ||
$(RUSTC) bar.rs --crate-type=cdylib | ||
$(RUSTC) foo.rs | ||
$(call RUN,foo) 2>&1 | $(CGREP) "Rust cannot catch foreign exceptions" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#![crate_type = "cdylib"] | ||
#![feature(c_unwind)] | ||
|
||
#[no_mangle] | ||
extern "C-unwind" fn panic() { | ||
panic!(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#![feature(c_unwind)] | ||
|
||
#[cfg_attr(not(windows), link(name = "bar"))] | ||
#[cfg_attr(windows, link(name = "bar.dll"))] | ||
extern "C-unwind" { | ||
fn panic(); | ||
} | ||
|
||
fn main() { | ||
let _ = std::panic::catch_unwind(|| { | ||
unsafe { panic() }; | ||
}); | ||
} |