about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-07-08 14:15:01 -0400
committerOneirical <manchot@videotron.ca>2024-07-17 15:33:07 -0400
commit98454ece33fc282fbcb27b8f56764347d247798d (patch)
treee23269d7c0d40e1ef33c58b152592bef0914c07b
parentd6a3f65db099716fb03f056716d4114948bf7087 (diff)
downloadrust-98454ece33fc282fbcb27b8f56764347d247798d.tar.gz
rust-98454ece33fc282fbcb27b8f56764347d247798d.zip
rewrite longjmp-across-rust to rmake
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/longjmp-across-rust/Makefile6
-rw-r--r--tests/run-make/longjmp-across-rust/rmake.rs18
3 files changed, 18 insertions, 7 deletions
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index 645f489cb39..2f2af6b8bc1 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -65,7 +65,6 @@ run-make/link-path-order/Makefile
 run-make/linkage-attr-on-static/Makefile
 run-make/long-linker-command-lines-cmd-exe/Makefile
 run-make/long-linker-command-lines/Makefile
-run-make/longjmp-across-rust/Makefile
 run-make/lto-linkage-used-attr/Makefile
 run-make/lto-no-link-whole-rlib/Makefile
 run-make/lto-smoke-c/Makefile
diff --git a/tests/run-make/longjmp-across-rust/Makefile b/tests/run-make/longjmp-across-rust/Makefile
deleted file mode 100644
index 5fd2d4f855f..00000000000
--- a/tests/run-make/longjmp-across-rust/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# ignore-cross-compile
-include ../tools.mk
-
-all: $(call NATIVE_STATICLIB,foo)
-	$(RUSTC) main.rs
-	$(call RUN,main)
diff --git a/tests/run-make/longjmp-across-rust/rmake.rs b/tests/run-make/longjmp-across-rust/rmake.rs
new file mode 100644
index 00000000000..90a527077d2
--- /dev/null
+++ b/tests/run-make/longjmp-across-rust/rmake.rs
@@ -0,0 +1,18 @@
+// longjmp, an error handling function used in C, is useful
+// for jumping out of nested call chains... but it used to accidentally
+// trigger Rust's cleanup system in a way that caused an unexpected abortion
+// of the program. After this was fixed in #48572, this test compiles and executes
+// a program that jumps between Rust and its C library, with longjmp included. For
+// the test to succeed, no unexpected abortion should occur.
+// See https://github.com/rust-lang/rust/pull/48572
+
+//@ ignore-cross-compile
+// Reason: the compiled binary is executed
+
+use run_make_support::{build_native_static_lib, run, rustc};
+
+fn main() {
+    build_native_static_lib("foo");
+    rustc().input("main.rs").run();
+    run("main");
+}