about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-07-16 14:01:02 -0400
committerOneirical <manchot@videotron.ca>2024-07-17 16:10:44 -0400
commit890ef1180b96683602ecd7ce0fe19a431d6474e2 (patch)
tree8d9f61d0d02e6f6a1ec2840abe25852668a1c9bd
parentd83ada35ed22598398ee1cc629b8f544c627197f (diff)
downloadrust-890ef1180b96683602ecd7ce0fe19a431d6474e2.tar.gz
rust-890ef1180b96683602ecd7ce0fe19a431d6474e2.zip
rewrite missing-crate-dependency to rmake
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/missing-crate-dependency/Makefile9
-rw-r--r--tests/run-make/missing-crate-dependency/rmake.rs17
3 files changed, 17 insertions, 10 deletions
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index 9e9d70bc6c6..349f0e3169f 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -75,7 +75,6 @@ run-make/macos-deployment-target/Makefile
 run-make/macos-fat-archive/Makefile
 run-make/manual-link/Makefile
 run-make/min-global-align/Makefile
-run-make/missing-crate-dependency/Makefile
 run-make/native-link-modifier-bundle/Makefile
 run-make/native-link-modifier-whole-archive/Makefile
 run-make/no-alloc-shim/Makefile
diff --git a/tests/run-make/missing-crate-dependency/Makefile b/tests/run-make/missing-crate-dependency/Makefile
deleted file mode 100644
index 7c271ab8a90..00000000000
--- a/tests/run-make/missing-crate-dependency/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-include ../tools.mk
-
-all:
-	$(RUSTC) --crate-type=rlib crateA.rs
-	$(RUSTC) --crate-type=rlib crateB.rs
-	$(call REMOVE_RLIBS,crateA)
-	# Ensure crateC fails to compile since dependency crateA is missing
-	$(RUSTC) crateC.rs 2>&1 | \
-		$(CGREP) 'can'"'"'t find crate for `crateA` which `crateB` depends on'
diff --git a/tests/run-make/missing-crate-dependency/rmake.rs b/tests/run-make/missing-crate-dependency/rmake.rs
new file mode 100644
index 00000000000..ab916fc6b61
--- /dev/null
+++ b/tests/run-make/missing-crate-dependency/rmake.rs
@@ -0,0 +1,17 @@
+// A simple smoke test to check that rustc fails compilation
+// and outputs a helpful message when a dependency is missing
+// in a dependency chain.
+// See https://github.com/rust-lang/rust/issues/12146
+
+use run_make_support::{fs_wrapper, rust_lib_name, rustc};
+
+fn main() {
+    rustc().crate_type("rlib").input("crateA.rs").run();
+    rustc().crate_type("rlib").input("crateB.rs").run();
+    fs_wrapper::remove_file(rust_lib_name("crateA"));
+    // Ensure that crateC fails to compile, as the crateA dependency is missing.
+    rustc()
+        .input("crateC.rs")
+        .run_fail()
+        .assert_stderr_contains("can't find crate for `crateA` which `crateB` depends on");
+}