about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-07-08 15:06:16 -0400
committerOneirical <manchot@videotron.ca>2024-07-17 15:33:17 -0400
commitc68d25b0977b5415fdffb48c381ee1c49fb31322 (patch)
tree442db2113685f9c811a0b4719309aab07a2c47b5
parentf7d67d6b6855d0f3880668f2f2d0dabc02caef31 (diff)
downloadrust-c68d25b0977b5415fdffb48c381ee1c49fb31322.tar.gz
rust-c68d25b0977b5415fdffb48c381ee1c49fb31322.zip
rewrite extern-fn-mangle to rmake
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/extern-fn-mangle/Makefile6
-rw-r--r--tests/run-make/extern-fn-mangle/rmake.rs16
3 files changed, 16 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 1c6fc57bd81..2c272706e7d 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -25,7 +25,6 @@ run-make/export-executable-symbols/Makefile
 run-make/extern-diff-internal-name/Makefile
 run-make/extern-flag-disambiguates/Makefile
 run-make/extern-fn-generic/Makefile
-run-make/extern-fn-mangle/Makefile
 run-make/extern-fn-reachable/Makefile
 run-make/extern-fn-with-union/Makefile
 run-make/extern-multiple-copies/Makefile
diff --git a/tests/run-make/extern-fn-mangle/Makefile b/tests/run-make/extern-fn-mangle/Makefile
deleted file mode 100644
index 3cbbf383996..00000000000
--- a/tests/run-make/extern-fn-mangle/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# ignore-cross-compile
-include ../tools.mk
-
-all: $(call NATIVE_STATICLIB,test)
-	$(RUSTC) test.rs
-	$(call RUN,test) || exit 1
diff --git a/tests/run-make/extern-fn-mangle/rmake.rs b/tests/run-make/extern-fn-mangle/rmake.rs
new file mode 100644
index 00000000000..3db8b2a0db0
--- /dev/null
+++ b/tests/run-make/extern-fn-mangle/rmake.rs
@@ -0,0 +1,16 @@
+// In this test, the functions foo() and bar() must avoid being mangled, as
+// the external C function depends on them to return the correct sum of 3 + 5 = 8.
+// This test therefore checks that the compiled and executed program respects the
+// #[no_mangle] flags successfully.
+// See https://github.com/rust-lang/rust/pull/15831
+
+//@ 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("test");
+    rustc().input("test.rs").run();
+    run("test");
+}