Skip to content

Commit 441f4b5

Browse files
committed
Rollup merge of rust-lang#52080 - oli-obk:dep_dedup_diagnostics, r=kennytm
Improve dependency deduplication diagnostics r? @kennytm this is obviously hard to test 😆 cc rust-lang#52072
2 parents 01fb455 + f352e98 commit 441f4b5

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

src/bootstrap/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@
115115
116116
#![deny(warnings)]
117117
#![feature(core_intrinsics)]
118+
#![feature(drain_filter)]
118119

119120
#[macro_use]
120121
extern crate build_helper;

src/bootstrap/tool.rs

+22-6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use std::env;
1313
use std::iter;
1414
use std::path::PathBuf;
1515
use std::process::{Command, exit};
16+
use std::collections::HashSet;
1617

1718
use Mode;
1819
use Compiler;
@@ -122,8 +123,13 @@ impl Step for ToolBuild {
122123
let mut duplicates = Vec::new();
123124
let is_expected = compile::stream_cargo(builder, &mut cargo, &mut |msg| {
124125
// Only care about big things like the RLS/Cargo for now
125-
if tool != "rls" && tool != "cargo" && tool != "clippy-driver" {
126-
return
126+
match tool {
127+
| "rls"
128+
| "cargo"
129+
| "clippy-driver"
130+
=> {}
131+
132+
_ => return,
127133
}
128134
let (id, features, filenames) = match msg {
129135
compile::CargoMessage::CompilerArtifact {
@@ -182,12 +188,22 @@ impl Step for ToolBuild {
182188
typically means that something was recompiled because \
183189
a transitive dependency has different features activated \
184190
than in a previous build:\n");
191+
println!("the following dependencies are duplicated although they \
192+
have the same features enabled:");
193+
for (id, cur, prev) in duplicates.drain_filter(|(_, cur, prev)| cur.2 == prev.2) {
194+
println!(" {}", id);
195+
// same features
196+
println!(" `{}` ({:?})\n `{}` ({:?})", cur.0, cur.1, prev.0, prev.1);
197+
}
198+
println!("the following dependencies have different features:");
185199
for (id, cur, prev) in duplicates {
186200
println!(" {}", id);
187-
println!(" `{}` enabled features {:?} at {:?}",
188-
cur.0, cur.2, cur.1);
189-
println!(" `{}` enabled features {:?} at {:?}",
190-
prev.0, prev.2, prev.1);
201+
let cur_features: HashSet<_> = cur.2.into_iter().collect();
202+
let prev_features: HashSet<_> = prev.2.into_iter().collect();
203+
println!(" `{}` additionally enabled features {:?} at {:?}",
204+
cur.0, &cur_features - &prev_features, cur.1);
205+
println!(" `{}` additionally enabled features {:?} at {:?}",
206+
prev.0, &prev_features - &cur_features, prev.1);
191207
}
192208
println!("");
193209
panic!("tools should not compile multiple copies of the same crate");

0 commit comments

Comments
 (0)