From 5b1860a24e78fbe2d906574141e904c58c61a4ec Mon Sep 17 00:00:00 2001 From: Oneirical Date: Fri, 12 Jul 2024 14:33:16 -0400 Subject: [PATCH] rewrite return-non-c-like-enum-from-c to rmake --- .../tidy/src/allowed_run_make_makefiles.txt | 1 - .../return-non-c-like-enum-from-c/Makefile | 6 ------ .../return-non-c-like-enum-from-c/rmake.rs | 17 +++++++++++++++++ 3 files changed, 17 insertions(+), 7 deletions(-) delete mode 100644 tests/run-make/return-non-c-like-enum-from-c/Makefile create mode 100644 tests/run-make/return-non-c-like-enum-from-c/rmake.rs 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"); +}