about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/extern-overrides-distribution/Makefile6
-rw-r--r--tests/run-make/extern-overrides-distribution/rmake.rs14
3 files changed, 14 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 691248ea260..8eee16e87a8 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -49,7 +49,6 @@ run-make/extern-fn-with-packed-struct/Makefile
 run-make/extern-fn-with-union/Makefile
 run-make/extern-multiple-copies/Makefile
 run-make/extern-multiple-copies2/Makefile
-run-make/extern-overrides-distribution/Makefile
 run-make/extra-filename-with-temp-outputs/Makefile
 run-make/fmt-write-bloat/Makefile
 run-make/forced-unwind-terminate-pof/Makefile
diff --git a/tests/run-make/extern-overrides-distribution/Makefile b/tests/run-make/extern-overrides-distribution/Makefile
deleted file mode 100644
index bfd0dd6991b..00000000000
--- a/tests/run-make/extern-overrides-distribution/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# ignore-cross-compile
-include ../tools.mk
-
-all:
-	$(RUSTC) libc.rs -Cmetadata=foo
-	$(RUSTC) main.rs --extern libc=$(TMPDIR)/liblibc.rlib
diff --git a/tests/run-make/extern-overrides-distribution/rmake.rs b/tests/run-make/extern-overrides-distribution/rmake.rs
new file mode 100644
index 00000000000..bd2553d4134
--- /dev/null
+++ b/tests/run-make/extern-overrides-distribution/rmake.rs
@@ -0,0 +1,14 @@
+// The --extern flag should override any "crate_type" declarations in the
+// Rust files themselves. In this test, libc is compiled as "lib", but
+// main.rs will only run with an rlib, which checks if the --extern flag
+// is successfully overriding the default behaviour.
+// See https://github.com/rust-lang/rust/pull/21782
+
+//@ ignore-cross-compile
+
+use run_make_support::{rust_lib_name, rustc};
+
+fn main() {
+    rustc().input("libc.rs").metadata("foo").run();
+    rustc().input("main.rs").extern_("libc", rust_lib_name("libc")).run();
+}