rewrite foreign-rust-exceptions to rmake

This commit is contained in:
Oneirical 2024-07-22 11:55:20 -04:00
parent e2dbba8d4d
commit 2a3e4c547b
3 changed files with 23 additions and 14 deletions

View File

@ -14,7 +14,6 @@ run-make/extern-fn-reachable/Makefile
run-make/fmt-write-bloat/Makefile
run-make/foreign-double-unwind/Makefile
run-make/foreign-exceptions/Makefile
run-make/foreign-rust-exceptions/Makefile
run-make/incr-add-rust-src-component/Makefile
run-make/issue-35164/Makefile
run-make/issue-36710/Makefile

View File

@ -1,13 +0,0 @@
# ignore-cross-compile
# ignore-i686-pc-windows-gnu
# needs-unwind
# This test doesn't work on 32-bit MinGW as cdylib has its own copy of unwinder
# so cross-DLL unwinding does not work.
include ../tools.mk
all:
$(RUSTC) bar.rs --crate-type=cdylib
$(RUSTC) foo.rs
$(call RUN,foo) 2>&1 | $(CGREP) "Rust cannot catch foreign exceptions"

View File

@ -0,0 +1,23 @@
// Rust exceptions can be foreign (from C code, in this test) or local. Foreign
// exceptions should not be caught, as that can cause undefined behaviour. Instead
// of catching them, #102721 made it so that the binary panics in execution with a helpful message.
// This test checks that the correct message appears and that execution fails when trying to catch
// a foreign exception.
// See https://github.com/rust-lang/rust/issues/102715
//@ ignore-cross-compile
// Reason: the compiled binary is executed
//@ needs-unwind
// Reason: unwinding panics is exercised in this test
//FIXME(Oneirical): ignore-i686-pc-windows-gnu
// This test doesn't work on 32-bit MinGW as cdylib has its own copy of unwinder
// so cross-DLL unwinding does not work.
use run_make_support::{run_fail, rustc};
fn main() {
rustc().input("bar.rs").crate_type("cdylib").run();
rustc().input("foo.rs").run();
run_fail("foo").assert_stderr_contains("Rust cannot catch foreign exceptions");
}