From 27334943ed92216760e232f0276610271ee3305b Mon Sep 17 00:00:00 2001 From: Oneirical Date: Fri, 19 Jul 2024 14:39:42 -0400 Subject: [PATCH] rewrite c-unwind-abi-catch-panic to rmake --- .../tidy/src/allowed_run_make_makefiles.txt | 1 - .../run-make/c-unwind-abi-catch-panic/Makefile | 10 ---------- .../run-make/c-unwind-abi-catch-panic/rmake.rs | 18 ++++++++++++++++++ 3 files changed, 18 insertions(+), 11 deletions(-) delete mode 100644 tests/run-make/c-unwind-abi-catch-panic/Makefile create mode 100644 tests/run-make/c-unwind-abi-catch-panic/rmake.rs diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index 8612d591c7e..ed1ae071f07 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -4,7 +4,6 @@ run-make/c-dynamic-rlib/Makefile run-make/c-static-dylib/Makefile run-make/c-static-rlib/Makefile run-make/c-unwind-abi-catch-lib-panic/Makefile -run-make/c-unwind-abi-catch-panic/Makefile run-make/cat-and-grep-sanity-check/Makefile run-make/cdylib-dylib-linkage/Makefile run-make/compiler-lookup-paths-2/Makefile diff --git a/tests/run-make/c-unwind-abi-catch-panic/Makefile b/tests/run-make/c-unwind-abi-catch-panic/Makefile deleted file mode 100644 index 0a38d838e32..00000000000 --- a/tests/run-make/c-unwind-abi-catch-panic/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# Exercise unwinding a panic. This catches a panic across an FFI boundary and downcasts it into an integer. The Rust code that panics is in the same directory. -# See https://github.com/rust-lang/rust/commit/baf227ea0c1e07fc54395a51e4b3881d701180cb - -# ignore-cross-compile -# needs-unwind -include ../tools.mk - -all: $(call NATIVE_STATICLIB,add) - $(RUSTC) main.rs - $(call RUN,main) || exit 1 diff --git a/tests/run-make/c-unwind-abi-catch-panic/rmake.rs b/tests/run-make/c-unwind-abi-catch-panic/rmake.rs new file mode 100644 index 00000000000..a99dbd18ec6 --- /dev/null +++ b/tests/run-make/c-unwind-abi-catch-panic/rmake.rs @@ -0,0 +1,18 @@ +// A test for calling `C-unwind` functions across foreign function boundaries (FFI). +// This test triggers a panic when calling a foreign function that calls *back* into Rust. +// This catches a panic across an FFI boundary and downcasts it into an integer. +// The Rust code that panics is in the same directory, unlike `c-unwind-abi-catch-lib-panic`. +// See https://github.com/rust-lang/rust/pull/76570 + +//@ ignore-cross-compile +// Reason: the compiled binary is executed +//@ needs-unwind +// Reason: this test exercises panic unwinding + +use run_make_support::{build_native_static_lib, run, rustc}; + +fn main() { + build_native_static_lib("add"); + rustc().input("main.rs").run(); + run("main"); +}