rewrite missing-crate-dependency to rmake

This commit is contained in:
Oneirical 2024-07-16 14:01:02 -04:00
parent d83ada35ed
commit 890ef1180b
3 changed files with 17 additions and 10 deletions

View File

@ -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

View File

@ -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'

View File

@ -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");
}