about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-07-06 07:07:24 +0800
committerkennytm <kennytm@gmail.com>2018-07-06 12:56:24 +0800
commitf1a36fc29f72b3187288e420b2c4c72a56ce1238 (patch)
tree161d1349785fd470c37f45415d8830096415b1de /src/bootstrap
parent596d1a782d6debf0185c9908d3fa064fc7811a85 (diff)
parentf352e98ddc17a992d724053e89479e0fbf080343 (diff)
downloadrust-f1a36fc29f72b3187288e420b2c4c72a56ce1238.tar.gz
rust-f1a36fc29f72b3187288e420b2c4c72a56ce1238.zip
Rollup merge of #52080 - oli-obk:dep_dedup_diagnostics, r=kennytm
Improve dependency deduplication diagnostics

r? @kennytm

this is obviously hard to test :laughing:

cc #52072
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/lib.rs1
-rw-r--r--src/bootstrap/tool.rs28
2 files changed, 23 insertions, 6 deletions
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index c885c842e40..168cbde7e0d 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -115,6 +115,7 @@
 
 #![deny(warnings)]
 #![feature(core_intrinsics)]
+#![feature(drain_filter)]
 
 #[macro_use]
 extern crate build_helper;
diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index 32d1e428e76..b3d7b9a91ec 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -13,6 +13,7 @@ use std::env;
 use std::iter;
 use std::path::PathBuf;
 use std::process::{Command, exit};
+use std::collections::HashSet;
 
 use Mode;
 use Compiler;
@@ -122,8 +123,13 @@ impl Step for ToolBuild {
         let mut duplicates = Vec::new();
         let is_expected = compile::stream_cargo(builder, &mut cargo, &mut |msg| {
             // Only care about big things like the RLS/Cargo for now
-            if tool != "rls" && tool != "cargo" && tool != "clippy-driver" {
-                return
+            match tool {
+                | "rls"
+                | "cargo"
+                | "clippy-driver"
+                => {}
+
+                _ => return,
             }
             let (id, features, filenames) = match msg {
                 compile::CargoMessage::CompilerArtifact {
@@ -182,12 +188,22 @@ impl Step for ToolBuild {
                       typically means that something was recompiled because \
                       a transitive dependency has different features activated \
                       than in a previous build:\n");
+            println!("the following dependencies are duplicated although they \
+                      have the same features enabled:");
+            for (id, cur, prev) in duplicates.drain_filter(|(_, cur, prev)| cur.2 == prev.2) {
+                println!("  {}", id);
+                // same features
+                println!("    `{}` ({:?})\n    `{}` ({:?})", cur.0, cur.1, prev.0, prev.1);
+            }
+            println!("the following dependencies have different features:");
             for (id, cur, prev) in duplicates {
                 println!("  {}", id);
-                println!("    `{}` enabled features {:?} at {:?}",
-                         cur.0, cur.2, cur.1);
-                println!("    `{}` enabled features {:?} at {:?}",
-                         prev.0, prev.2, prev.1);
+                let cur_features: HashSet<_> = cur.2.into_iter().collect();
+                let prev_features: HashSet<_> = prev.2.into_iter().collect();
+                println!("    `{}` additionally enabled features {:?} at {:?}",
+                         cur.0, &cur_features - &prev_features, cur.1);
+                println!("    `{}` additionally enabled features {:?} at {:?}",
+                         prev.0, &prev_features - &cur_features, prev.1);
             }
             println!("");
             panic!("tools should not compile multiple copies of the same crate");