about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-08-01 16:49:30 +0200
committerGitHub <noreply@github.com>2022-08-01 16:49:30 +0200
commit1530ed8373ea3f8863efceb3b0584b4cf0bdbada (patch)
tree5be79edd3ed0d4b8f57fdf9fe2e02c70868e76f6
parentf9aa989eac08f0ef49453af696218336870647c8 (diff)
parent339509494dabe8c8df14b591cd8761c6ce8ddfe7 (diff)
downloadrust-1530ed8373ea3f8863efceb3b0584b4cf0bdbada.tar.gz
rust-1530ed8373ea3f8863efceb3b0584b4cf0bdbada.zip
Rollup merge of #99864 - klensy:bootstrap-art-dupe, r=jyn514
bootstrap: don't emit warn about duplicated deps with same/different features if some of sets actually empty

Example (https://github.com/rust-lang-ci/rust/runs/7551453940?check_suite_focus=true#step:25:15008):
```
 duplicate artifacts found when compiling a tool, this typically means that something was recompiled because a transitive dependency has different features activated than in a previous build:

the following dependencies are duplicated although they have the same features enabled:
the following dependencies have different features:
  memchr 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)
    `clippy-driver` additionally enabled features {} at "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-freebsd/release/deps/libmemchr-44aa6ff4f08e293f.rlib"
    `cargo` additionally enabled features {"use_std"} at "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-freebsd/release/deps/libmemchr-70e29af0fd3ef292.rlib"
```

Notice that no info printed under  `the following dependencies are duplicated although they have the same features enabled:`
-rw-r--r--src/bootstrap/tool.rs52
1 files changed, 28 insertions, 24 deletions
diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index 839a6d27199..06fa5039fdf 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -158,34 +158,38 @@ impl Step for ToolBuild {
                       a transitive dependency has different features activated \
                       than in a previous build:\n"
             );
-            eprintln!(
-                "the following dependencies are duplicated although they \
-                      have the same features enabled:"
-            );
             let (same, different): (Vec<_>, Vec<_>) =
                 duplicates.into_iter().partition(|(_, cur, prev)| cur.2 == prev.2);
-            for (id, cur, prev) in same {
-                eprintln!("  {}", id);
-                // same features
-                eprintln!("    `{}` ({:?})\n    `{}` ({:?})", cur.0, cur.1, prev.0, prev.1);
-            }
-            eprintln!("the following dependencies have different features:");
-            for (id, cur, prev) in different {
-                eprintln!("  {}", id);
-                let cur_features: HashSet<_> = cur.2.into_iter().collect();
-                let prev_features: HashSet<_> = prev.2.into_iter().collect();
-                eprintln!(
-                    "    `{}` additionally enabled features {:?} at {:?}",
-                    cur.0,
-                    &cur_features - &prev_features,
-                    cur.1
-                );
+            if !same.is_empty() {
                 eprintln!(
-                    "    `{}` additionally enabled features {:?} at {:?}",
-                    prev.0,
-                    &prev_features - &cur_features,
-                    prev.1
+                    "the following dependencies are duplicated although they \
+                      have the same features enabled:"
                 );
+                for (id, cur, prev) in same {
+                    eprintln!("  {}", id);
+                    // same features
+                    eprintln!("    `{}` ({:?})\n    `{}` ({:?})", cur.0, cur.1, prev.0, prev.1);
+                }
+            }
+            if !different.is_empty() {
+                eprintln!("the following dependencies have different features:");
+                for (id, cur, prev) in different {
+                    eprintln!("  {}", id);
+                    let cur_features: HashSet<_> = cur.2.into_iter().collect();
+                    let prev_features: HashSet<_> = prev.2.into_iter().collect();
+                    eprintln!(
+                        "    `{}` additionally enabled features {:?} at {:?}",
+                        cur.0,
+                        &cur_features - &prev_features,
+                        cur.1
+                    );
+                    eprintln!(
+                        "    `{}` additionally enabled features {:?} at {:?}",
+                        prev.0,
+                        &prev_features - &cur_features,
+                        prev.1
+                    );
+                }
             }
             eprintln!();
             eprintln!(