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/separate-link-fail/Makefile7
-rw-r--r--tests/run-make/separate-link-fail/foo.rs1
-rw-r--r--tests/run-make/separate-link-fail/rmake.rs15
4 files changed, 16 insertions, 8 deletions
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index 47d92dafb61..8f1d36bb26d 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -202,7 +202,6 @@ run-make/rustdoc-io-error/Makefile
 run-make/sanitizer-cdylib-link/Makefile
 run-make/sanitizer-dylib-link/Makefile
 run-make/sanitizer-staticlib-link/Makefile
-run-make/separate-link-fail/Makefile
 run-make/sepcomp-cci-copies/Makefile
 run-make/sepcomp-inlining/Makefile
 run-make/sepcomp-separate/Makefile
diff --git a/tests/run-make/separate-link-fail/Makefile b/tests/run-make/separate-link-fail/Makefile
deleted file mode 100644
index bfd18fbf972..00000000000
--- a/tests/run-make/separate-link-fail/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-include ../tools.mk
-
-all:
-	echo 'fn main(){}' > $(TMPDIR)/main.rs
-	# Make sure that this fails
-	! $(RUSTC) -Z link-only $(TMPDIR)/main.rs 2> $(TMPDIR)/stderr.txt
-	$(CGREP) "The input does not look like a .rlink file" < $(TMPDIR)/stderr.txt
diff --git a/tests/run-make/separate-link-fail/foo.rs b/tests/run-make/separate-link-fail/foo.rs
new file mode 100644
index 00000000000..f328e4d9d04
--- /dev/null
+++ b/tests/run-make/separate-link-fail/foo.rs
@@ -0,0 +1 @@
+fn main() {}
diff --git a/tests/run-make/separate-link-fail/rmake.rs b/tests/run-make/separate-link-fail/rmake.rs
new file mode 100644
index 00000000000..b5d5300de68
--- /dev/null
+++ b/tests/run-make/separate-link-fail/rmake.rs
@@ -0,0 +1,15 @@
+// rustc usually wants Rust code as its input. The flag `link-only` is one
+// exception, where a .rlink file is instead requested. The compiler should
+// fail when the user is wrongly passing the original Rust code
+// instead of the generated .rlink file when this flag is on.
+// https://github.com/rust-lang/rust/issues/95297
+
+use run_make_support::rustc;
+
+fn main() {
+    rustc()
+        .arg("-Zlink-only")
+        .input("foo.rs")
+        .run_fail()
+        .assert_stderr_contains("The input does not look like a .rlink file");
+}