about summary refs log tree commit diff
path: root/src/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools')
m---------src/tools/clippy24
m---------src/tools/rls0
m---------src/tools/rustfmt10
-rw-r--r--src/tools/tidy/src/deps.rs31
4 files changed, 40 insertions, 25 deletions
diff --git a/src/tools/clippy b/src/tools/clippy
-Subproject 7e5e4c1e7e80ed689a49101569dde2c19753dc8
+Subproject b109e1033476390f95c728d674909ef90f0ff0c
diff --git a/src/tools/rls b/src/tools/rls
-Subproject 6d72813199d24838636389c7025ce95c427692f
+Subproject c51e3ff2f07f84f26f57fcb51808b1ec7cbe45a
diff --git a/src/tools/rustfmt b/src/tools/rustfmt
-Subproject da17b689595ddc863b02eb1ba6831c87cefc1e2
+Subproject 5c9a2b6c13d3b6f8d3f9c02b130bb4b54fd489f
diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs
index c41377824fe..42f4e46085e 100644
--- a/src/tools/tidy/src/deps.rs
+++ b/src/tools/tidy/src/deps.rs
@@ -10,7 +10,7 @@
 
 //! Check license of third-party deps by inspecting src/vendor
 
-use std::collections::{BTreeSet, HashSet};
+use std::collections::{BTreeSet, HashSet, HashMap};
 use std::fs::File;
 use std::io::Read;
 use std::path::Path;
@@ -242,6 +242,8 @@ pub fn check_whitelist(path: &Path, cargo: &Path, bad: &mut bool) {
         }
         *bad = true;
     }
+
+    check_crate_duplicate(&resolve, bad);
 }
 
 fn check_license(path: &Path) -> bool {
@@ -344,3 +346,30 @@ fn check_crate_whitelist<'a, 'b>(
 
     unapproved
 }
+
+fn check_crate_duplicate(resolve: &Resolve, bad: &mut bool) {
+    const FORBIDDEN_TO_HAVE_DUPLICATES: &[&str] = &[
+        // These two crates take quite a long time to build, let's not let two
+        // versions of them accidentally sneak into our dependency graph to
+        // ensure we keep our CI times under control
+        // "cargo", // FIXME(#53005)
+        // "rustc-ap-syntax", // FIXME(#53006)
+    ];
+    let mut name_to_id = HashMap::new();
+    for node in resolve.nodes.iter() {
+        name_to_id.entry(node.id.split_whitespace().next().unwrap())
+            .or_insert(Vec::new())
+            .push(&node.id);
+    }
+
+    for name in FORBIDDEN_TO_HAVE_DUPLICATES {
+        if name_to_id[name].len() <= 1 {
+            continue
+        }
+        println!("crate `{}` is duplicated in `Cargo.lock`", name);
+        for id in name_to_id[name].iter() {
+            println!("  * {}", id);
+        }
+        *bad = true;
+    }
+}