about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-07-12 15:32:46 -0400
committerOneirical <manchot@videotron.ca>2024-07-19 12:27:47 -0400
commit01c7118fa99a0c1f2df47b25c63fae6f62ef6ed1 (patch)
tree4ba9a1ba148af0f39abec43d7d66d55ea6bdf82e
parent8a09f2231d91fad0ff09ec4d4b3a89ff0376f860 (diff)
downloadrust-01c7118fa99a0c1f2df47b25c63fae6f62ef6ed1.tar.gz
rust-01c7118fa99a0c1f2df47b25c63fae6f62ef6ed1.zip
rewrite extern-fn-with-union to rmake
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/extern-fn-generic/rmake.rs1
-rw-r--r--tests/run-make/extern-fn-with-union/Makefile7
-rw-r--r--tests/run-make/extern-fn-with-union/rmake.rs16
4 files changed, 17 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 ef18b6f16a2..421097a4bdf 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -21,7 +21,6 @@ run-make/export-executable-symbols/Makefile
 run-make/extern-diff-internal-name/Makefile
 run-make/extern-flag-disambiguates/Makefile
 run-make/extern-fn-reachable/Makefile
-run-make/extern-fn-with-union/Makefile
 run-make/extern-multiple-copies/Makefile
 run-make/extern-multiple-copies2/Makefile
 run-make/fmt-write-bloat/Makefile
diff --git a/tests/run-make/extern-fn-generic/rmake.rs b/tests/run-make/extern-fn-generic/rmake.rs
index 3dee1e20544..05de839a1b0 100644
--- a/tests/run-make/extern-fn-generic/rmake.rs
+++ b/tests/run-make/extern-fn-generic/rmake.rs
@@ -2,6 +2,7 @@
 // test simply runs a Rust program containing generics that is also reliant on
 // a C library, and checks that compilation and execution are successful.
 // See https://github.com/rust-lang/rust/pull/15831
+
 //@ ignore-cross-compile
 // Reason: the compiled binary is executed
 
diff --git a/tests/run-make/extern-fn-with-union/Makefile b/tests/run-make/extern-fn-with-union/Makefile
deleted file mode 100644
index e6c8c993679..00000000000
--- a/tests/run-make/extern-fn-with-union/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# ignore-cross-compile
-include ../tools.mk
-
-all: $(call NATIVE_STATICLIB,ctest)
-	$(RUSTC) testcrate.rs
-	$(RUSTC) test.rs
-	$(call RUN,test) || exit 1
diff --git a/tests/run-make/extern-fn-with-union/rmake.rs b/tests/run-make/extern-fn-with-union/rmake.rs
new file mode 100644
index 00000000000..200602eabeb
--- /dev/null
+++ b/tests/run-make/extern-fn-with-union/rmake.rs
@@ -0,0 +1,16 @@
+// If an external function from foreign-function interface was called upon,
+// its attributes would only be passed to LLVM if and only if it was called in the same crate.
+// This caused passing around unions to be incorrect.
+// See https://github.com/rust-lang/rust/pull/14191
+
+//@ 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("ctest");
+    rustc().input("testcrate.rs").run();
+    rustc().input("test.rs").run();
+    run("test");
+}