From e2ab98df085d4f2703f0a4beab4c6432c353f7fa Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Mon, 22 Jun 2020 13:29:04 -0400 Subject: [PATCH] Stop using old version of `syn` in `rustc-workspace-hack` None of the tools seem to need syn 0.15.35, so we can just build syn 1.0. This was causing an issue with clippy's `compile-test` program: since multiple versions of `syn` would exist in the build directory, we would non-deterministically pick one based on filesystem iteration order. If the pre-1.0 version of `syn` was picked, a strange build error would occur (see https://github.com/rust-lang/rust/pull/73594#issuecomment-647671463) To prevent this kind of issue from happening again, we now panic if we find multiple versions of a crate in the build directly, instead of silently picking the first version we find. --- Cargo.lock | 1 - src/tools/clippy/tests/compile-test.rs | 4 +++- src/tools/rustc-workspace-hack/Cargo.toml | 3 +-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0c1c533f395..9b406d4a1f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3532,7 +3532,6 @@ dependencies = [ "serde_json", "smallvec 0.6.10", "smallvec 1.4.0", - "syn 0.15.35", "syn 1.0.11", "url 2.1.0", "winapi 0.3.8", diff --git a/src/tools/clippy/tests/compile-test.rs b/src/tools/clippy/tests/compile-test.rs index f28aedbf0ab..368fa6a98c5 100644 --- a/src/tools/clippy/tests/compile-test.rs +++ b/src/tools/clippy/tests/compile-test.rs @@ -49,7 +49,9 @@ fn third_party_crates() -> String { if let Some(name) = path.file_name().and_then(OsStr::to_str) { for dep in CRATES { if name.starts_with(&format!("lib{}-", dep)) && name.ends_with(".rlib") { - crates.entry(dep).or_insert(path); + if let Some(old) = crates.insert(dep, path.clone()) { + panic!("Found multiple rlibs for crate `{}`: `{:?}` and `{:?}", dep, old, path); + } break; } } diff --git a/src/tools/rustc-workspace-hack/Cargo.toml b/src/tools/rustc-workspace-hack/Cargo.toml index 1b1f4447966..351e2d4481c 100644 --- a/src/tools/rustc-workspace-hack/Cargo.toml +++ b/src/tools/rustc-workspace-hack/Cargo.toml @@ -69,8 +69,7 @@ serde = { version = "1.0.82", features = ['derive'] } serde_json = { version = "1.0.31", features = ["raw_value"] } smallvec-0_6 = { package = "smallvec", version = "0.6", features = ['union', 'may_dangle'] } smallvec = { version = "1.0", features = ['union', 'may_dangle'] } -syn = { version = "0.15", features = ['full', 'extra-traits'] } -syn-1 = { package = "syn", version = "1", features = ['fold', 'full', 'extra-traits', 'visit'] } +syn = { version = "1", features = ['fold', 'full', 'extra-traits', 'visit'] } url = { version = "2.0", features = ['serde'] } [target.'cfg(not(windows))'.dependencies]