about summary refs log tree commit diff
path: root/tests/run-make/error-found-staticlib-instead-crate
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-06-14 15:50:33 -0400
committerOneirical <manchot@videotron.ca>2024-06-14 15:50:33 -0400
commite9ff47ff406dd6fd029333391bb5ed0be4c9464a (patch)
tree23adcaf33c9caf76fcc2e4422f45900110ebe124 /tests/run-make/error-found-staticlib-instead-crate
parentf8e566053207b4ecbcbc7a7d6ded82c43061e3da (diff)
downloadrust-e9ff47ff406dd6fd029333391bb5ed0be4c9464a.tar.gz
rust-e9ff47ff406dd6fd029333391bb5ed0be4c9464a.zip
rewrite error-found-staticlib-instead-crate to rmake
Diffstat (limited to 'tests/run-make/error-found-staticlib-instead-crate')
-rw-r--r--tests/run-make/error-found-staticlib-instead-crate/Makefile5
-rw-r--r--tests/run-make/error-found-staticlib-instead-crate/rmake.rs11
2 files changed, 11 insertions, 5 deletions
diff --git a/tests/run-make/error-found-staticlib-instead-crate/Makefile b/tests/run-make/error-found-staticlib-instead-crate/Makefile
deleted file mode 100644
index 0eae41d720c..00000000000
--- a/tests/run-make/error-found-staticlib-instead-crate/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-include ../tools.mk
-
-all:
-	$(RUSTC) foo.rs --crate-type staticlib
-	$(RUSTC) bar.rs 2>&1 | $(CGREP) "found staticlib"
diff --git a/tests/run-make/error-found-staticlib-instead-crate/rmake.rs b/tests/run-make/error-found-staticlib-instead-crate/rmake.rs
new file mode 100644
index 00000000000..8c707092b7e
--- /dev/null
+++ b/tests/run-make/error-found-staticlib-instead-crate/rmake.rs
@@ -0,0 +1,11 @@
+// When rustc is looking for a crate but is given a staticlib instead,
+// the error message should be helpful and indicate precisely the cause
+// of the compilation failure.
+// See https://github.com/rust-lang/rust/pull/21978
+
+use run_make_support::rustc;
+
+fn main() {
+    rustc().input("foo.rs").crate_type("staticlib").run();
+    rustc().input("bar.rs").run_fail().assert_stderr_contains("found staticlib");
+}