about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2024-05-15 22:01:19 +0200
committerGitHub <noreply@github.com>2024-05-15 22:01:19 +0200
commit09156291e55504d38435bab9181776db78c5841a (patch)
tree89cd59dc71aa740995870e51f56634b1bb001bde
parent80f991e09bb631788fb0cc5ceb34b29c0db9ca53 (diff)
parenta7484d2e49e8bec4e6b4c2442f07fdc77bf70966 (diff)
downloadrust-09156291e55504d38435bab9181776db78c5841a.tar.gz
rust-09156291e55504d38435bab9181776db78c5841a.zip
Rollup merge of #125146 - Oneirical:panic-impl, r=jieyouxu
Migrate `run-make/panic-impl-transitive` to `rmake`

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

The test itself is quite simple, but the "handle panics by entering infinite loop" part is strange.
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/panic-impl-transitive/Makefile7
-rw-r--r--tests/run-make/panic-impl-transitive/rmake.rs19
3 files changed, 19 insertions, 8 deletions
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index dd90c4e60d6..44c9616dbb1 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -190,7 +190,6 @@ run-make/output-with-hyphens/Makefile
 run-make/override-aliased-flags/Makefile
 run-make/overwrite-input/Makefile
 run-make/panic-abort-eh_frame/Makefile
-run-make/panic-impl-transitive/Makefile
 run-make/pass-linker-flags-flavor/Makefile
 run-make/pass-linker-flags-from-dep/Makefile
 run-make/pass-linker-flags/Makefile
diff --git a/tests/run-make/panic-impl-transitive/Makefile b/tests/run-make/panic-impl-transitive/Makefile
deleted file mode 100644
index 9a271a22e10..00000000000
--- a/tests/run-make/panic-impl-transitive/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-include ../tools.mk
-
-# NOTE we use --emit=llvm-ir to avoid running the linker (linking will fail because there's no main
-# in this crate)
-all:
-	$(RUSTC) panic-impl-provider.rs
-	$(RUSTC) panic-impl-consumer.rs -C panic=abort --emit=llvm-ir -L $(TMPDIR)
diff --git a/tests/run-make/panic-impl-transitive/rmake.rs b/tests/run-make/panic-impl-transitive/rmake.rs
new file mode 100644
index 00000000000..86308f593b3
--- /dev/null
+++ b/tests/run-make/panic-impl-transitive/rmake.rs
@@ -0,0 +1,19 @@
+// In Rust programs where the standard library is unavailable (#![no_std]), we may be interested
+// in customizing how panics are handled. Here, the provider specifies that panics should be handled
+// by entering an infinite loop. This test checks that this panic implementation can be transitively
+// provided by an external crate.
+// --emit=llvm-ir is used to avoid running the linker, as linking will fail due to the lack of main
+// function in the crate.
+// See https://github.com/rust-lang/rust/pull/50338
+
+use run_make_support::{rustc, tmp_dir};
+
+fn main() {
+    rustc().input("panic-impl-provider.rs").run();
+    rustc()
+        .input("panic-impl-consumer.rs")
+        .panic("abort")
+        .emit("llvm-ir")
+        .library_search_path(tmp_dir())
+        .run();
+}