Skip to content

Commit cbae9ed

Browse files
committed
Auto merge of #4115 - ehuss:fix-compiletest, r=Manishearth
Fix compile-test from forcing a rebuild. If the `compile-test` test was run, then running a cargo build command immediately after caused everything to be rebuilt. This is because the `compile-test` test was deleting all `.rmeta` files in the target directory. Cargo recently switched to always generating `.rmeta` files (rust-lang/cargo#6883), and when the files are deleted, it thinks it needs to be rebuilt. I am not very familiar with compiletest or clippy, so please take a close look and test this out (with the most recent nightly). In particular, make sure it doesn't revert the fixes from #3380 (it seems to work for me). Also @oli-obk mentioned something related in rust-lang/rust#60190 (comment), and I want to make sure that is addressed as well. Fixes #4114
2 parents 0331b95 + a8bf501 commit cbae9ed

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

tests/compile-test.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fn config(mode: &str, dir: PathBuf) -> compiletest::Config {
5252
// as we'll get a duplicate matching versions. Instead, disambiguate with
5353
// `--extern dep=path`.
5454
// See https://github.com/rust-lang/rust-clippy/issues/4015.
55-
let needs_disambiguation = ["serde"];
55+
let needs_disambiguation = ["serde", "regex", "clippy_lints"];
5656
// This assumes that deps are compiled (they are for Cargo integration tests).
5757
let deps = std::fs::read_dir(host_libs().join("deps")).unwrap();
5858
let disambiguated = deps
@@ -62,7 +62,7 @@ fn config(mode: &str, dir: PathBuf) -> compiletest::Config {
6262
// NOTE: This only handles a single dep
6363
// https://github.com/laumann/compiletest-rs/issues/101
6464
needs_disambiguation.iter().find_map(|dep| {
65-
if name.starts_with(&format!("lib{}-", dep)) {
65+
if name.starts_with(&format!("lib{}-", dep)) && name.ends_with(".rlib") {
6666
Some(format!("--extern {}={}", dep, path.display()))
6767
} else {
6868
None
@@ -95,8 +95,6 @@ fn config(mode: &str, dir: PathBuf) -> compiletest::Config {
9595

9696
fn run_mode(mode: &str, dir: PathBuf) {
9797
let cfg = config(mode, dir);
98-
// clean rmeta data, otherwise "cargo check; cargo test" fails (#2896)
99-
cfg.clean_rmeta();
10098
compiletest::run_tests(&cfg);
10199
}
102100

0 commit comments

Comments
 (0)