about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-07-12 14:33:16 -0400
committerOneirical <manchot@videotron.ca>2024-07-19 12:27:26 -0400
commit5b1860a24e78fbe2d906574141e904c58c61a4ec (patch)
treed0941329b87ace1a4109cde40e6a5cf7fc443e91
parent3811f40d2701b3a8923d2d46e36dd3a93a824b49 (diff)
downloadrust-5b1860a24e78fbe2d906574141e904c58c61a4ec.tar.gz
rust-5b1860a24e78fbe2d906574141e904c58c61a4ec.zip
rewrite return-non-c-like-enum-from-c to rmake
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/return-non-c-like-enum-from-c/Makefile6
-rw-r--r--tests/run-make/return-non-c-like-enum-from-c/rmake.rs17
3 files changed, 17 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 bd25a6c144e..07fd5d3e9b8 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -66,7 +66,6 @@ run-make/no-alloc-shim/Makefile
 run-make/no-builtins-attribute/Makefile
 run-make/no-duplicate-libs/Makefile
 run-make/panic-abort-eh_frame/Makefile
-run-make/pass-non-c-like-enum-to-c/Makefile
 run-make/pdb-buildinfo-cl-cmd/Makefile
 run-make/pgo-gen-lto/Makefile
 run-make/pgo-gen-no-imp-symbols/Makefile
diff --git a/tests/run-make/return-non-c-like-enum-from-c/Makefile b/tests/run-make/return-non-c-like-enum-from-c/Makefile
deleted file mode 100644
index bd441d321bf..00000000000
--- a/tests/run-make/return-non-c-like-enum-from-c/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# ignore-cross-compile
-include ../tools.mk
-
-all: $(call NATIVE_STATICLIB,test)
-	$(RUSTC) nonclike.rs -L$(TMPDIR) -ltest
-	$(call RUN,nonclike)
diff --git a/tests/run-make/return-non-c-like-enum-from-c/rmake.rs b/tests/run-make/return-non-c-like-enum-from-c/rmake.rs
new file mode 100644
index 00000000000..f24bd6d5fc7
--- /dev/null
+++ b/tests/run-make/return-non-c-like-enum-from-c/rmake.rs
@@ -0,0 +1,17 @@
+// A reversed version of the `return-non-c-like-enum` test, though
+// this time, the C code is the library, and the Rust code compiles
+// into the executable. Once again, enum variants should be treated
+// like an union of structs, which should prevent segfaults or
+// unexpected results.
+// See https://github.com/rust-lang/rust/issues/68190
+
+//@ 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("nonclike.rs").arg("-ltest").run();
+    run("nonclike");
+}