From 205bfe72130fc9ea3eb646a5d3d59d0525b8d708 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Mon, 8 Jul 2024 14:35:30 -0400 Subject: [PATCH] rewrite static-extern-type to rmake --- .../tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/static-extern-type/Makefile | 6 ------ tests/run-make/static-extern-type/rmake.rs | 16 ++++++++++++++++ 3 files changed, 16 insertions(+), 7 deletions(-) delete mode 100644 tests/run-make/static-extern-type/Makefile create mode 100644 tests/run-make/static-extern-type/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 2f2af6b8bc1..51614f84ec3 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -108,7 +108,6 @@ run-make/simd-ffi/Makefile run-make/split-debuginfo/Makefile run-make/stable-symbol-names/Makefile run-make/static-dylib-by-default/Makefile -run-make/static-extern-type/Makefile run-make/staticlib-blank-lib/Makefile run-make/staticlib-dylib-linkage/Makefile run-make/symbol-mangling-hashed/Makefile diff --git a/tests/run-make/static-extern-type/Makefile b/tests/run-make/static-extern-type/Makefile deleted file mode 100644 index 77897154322..00000000000 --- a/tests/run-make/static-extern-type/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -all: $(call NATIVE_STATICLIB,define-foo) - $(RUSTC) -ldefine-foo use-foo.rs - $(call RUN,use-foo) || exit 1 diff --git a/tests/run-make/static-extern-type/rmake.rs b/tests/run-make/static-extern-type/rmake.rs new file mode 100644 index 00000000000..d30153f9c68 --- /dev/null +++ b/tests/run-make/static-extern-type/rmake.rs @@ -0,0 +1,16 @@ +// Static variables coming from a C library through foreign function interface (FFI) are unsized +// at compile time - and assuming they are sized used to cause an internal compiler error (ICE). +// After this was fixed in #58192, this test checks that external statics can be safely used in +// a program that both compiles and executes successfully. +// See https://github.com/rust-lang/rust/issues/57876 + +//@ 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("define-foo"); + rustc().arg("-ldefine-foo").input("use-foo.rs").run(); + run("use-foo"); +}