From 228bbb36ad155d5fbd2d1f783742a4c7ecd2e0c5 Mon Sep 17 00:00:00 2001 From: Jamie Hill-Daniel Date: Tue, 4 Aug 2026 20:11:32 +0100 Subject: [PATCH] fix(bootstrap): Normalize the names of proc macro dependency crates --- src/bootstrap/src/utils/proc_macro_deps.rs | 56 +++++++++++----------- src/tools/tidy/src/deps.rs | 11 ++++- 2 files changed, 37 insertions(+), 30 deletions(-) diff --git a/src/bootstrap/src/utils/proc_macro_deps.rs b/src/bootstrap/src/utils/proc_macro_deps.rs index 8e91f95e18f3f..02d8fe41f5869 100644 --- a/src/bootstrap/src/utils/proc_macro_deps.rs +++ b/src/bootstrap/src/utils/proc_macro_deps.rs @@ -6,46 +6,46 @@ pub static CRATES: &[&str] = &[ "anyhow", "askama_derive", "askama_parser", - "basic-toml", + "basic_toml", "bitflags", - "block-buffer", + "block_buffer", "bumpalo", - "cfg-if", + "cfg_if", "cpufeatures", - "crypto-common", + "crypto_common", "darling", "darling_core", "derive_builder_core", "digest", "equivalent", - "fluent-bundle", - "fluent-langneg", - "fluent-syntax", + "fluent_bundle", + "fluent_langneg", + "fluent_syntax", "fnv", "foldhash", - "generic-array", + "generic_array", "glob", "hashbrown", "heck", - "id-arena", + "id_arena", "ident_case", "indexmap", - "intl-memoizer", + "intl_memoizer", "intl_pluralrules", "itoa", "leb128fmt", "libc", "log", "memchr", - "minimal-lexical", + "minimal_lexical", "nom", "pest", "pest_generator", "pest_meta", "prettyplease", - "proc-macro2", + "proc_macro2", "quote", - "rustc-hash", + "rustc_hash", "ryu", "self_cell", "semver", @@ -61,25 +61,25 @@ pub static CRATES: &[&str] = &[ "synstructure", "thiserror", "tinystr", - "type-map", + "type_map", "typenum", - "ucd-trie", - "unic-langid", - "unic-langid-impl", - "unic-langid-macros", - "unicode-ident", - "unicode-xid", + "ucd_trie", + "unic_langid", + "unic_langid_impl", + "unic_langid_macros", + "unicode_ident", + "unicode_xid", "version_check", - "wasm-bindgen-macro-support", - "wasm-bindgen-shared", - "wasm-encoder", - "wasm-metadata", + "wasm_bindgen_macro_support", + "wasm_bindgen_shared", + "wasm_encoder", + "wasm_metadata", "wasmparser", "winnow", - "wit-bindgen-core", - "wit-bindgen-rust", - "wit-component", - "wit-parser", + "wit_bindgen_core", + "wit_bindgen_rust", + "wit_component", + "wit_parser", "yoke", "zerofrom", "zerovec", diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index 479199414d7ec..734ca79518090 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -719,8 +719,15 @@ fn check_proc_macro_dep_list(root: &Path, cargo: &Path, bless: bool, check: &mut // Remove the proc-macro crates themselves proc_macro_deps.retain(|pkg| !is_proc_macro_pkg(&metadata[pkg])); // Sort and deduplicate the crate names. - let proc_macro_deps = - proc_macro_deps.into_iter().map(|dep| metadata[dep].name.as_ref()).collect::>(); + // Cargo package names may contain `-`, but will normalize these to `_` before passing to rustc. + // As bootstrap parses the `--crate-name` flag, use the name of the actual lib target which has + // been normalized. + let proc_macro_deps = proc_macro_deps + .into_iter() + .filter_map(|dep| { + metadata[dep].targets.iter().find_map(|target| target.is_lib().then_some(&target.name)) + }) + .collect::>(); let expected = { use std::fmt::Write;