about summary refs log tree commit diff
path: root/tests/run-make/return-non-c-like-enum-from-c
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 /tests/run-make/return-non-c-like-enum-from-c
parent3811f40d2701b3a8923d2d46e36dd3a93a824b49 (diff)
downloadrust-5b1860a24e78fbe2d906574141e904c58c61a4ec.tar.gz
rust-5b1860a24e78fbe2d906574141e904c58c61a4ec.zip
rewrite return-non-c-like-enum-from-c to rmake
Diffstat (limited to 'tests/run-make/return-non-c-like-enum-from-c')
-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
2 files changed, 17 insertions, 6 deletions
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");
+}