From 348bfe3e355a4479287d3940ca6b87f9be967040 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 13 Jan 2026 10:54:33 -0800 Subject: [PATCH 1/3] compiler: upgrade to hashbrown 0.16.1 See also #135634, #149159, and rust-lang/hashbrown#662. This includes an in-tree upgrade of `indexmap` as well, which uses the new `HashTable` buckets API internally, hopefully impacting performance for the better! --- Cargo.lock | 19 +++++++++++-------- compiler/rustc_data_structures/Cargo.toml | 4 ++-- compiler/rustc_mir_transform/Cargo.toml | 2 +- compiler/rustc_query_system/Cargo.toml | 2 +- src/bootstrap/src/utils/proc_macro_deps.rs | 1 + 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bf28939ac87b2..45d01c486faf3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1670,9 +1670,12 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "foldhash 0.2.0", +] [[package]] name = "heck" @@ -1950,12 +1953,12 @@ checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5" [[package]] name = "indexmap" -version = "2.12.0" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f" +checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" dependencies = [ "equivalent", - "hashbrown 0.16.0", + "hashbrown 0.16.1", "serde", "serde_core", ] @@ -3730,7 +3733,7 @@ dependencies = [ "either", "elsa", "ena", - "hashbrown 0.15.5", + "hashbrown 0.16.1", "indexmap", "jobserver", "libc", @@ -4346,7 +4349,7 @@ name = "rustc_mir_transform" version = "0.0.0" dependencies = [ "either", - "hashbrown 0.15.5", + "hashbrown 0.16.1", "itertools", "rustc_abi", "rustc_arena", @@ -4557,7 +4560,7 @@ dependencies = [ name = "rustc_query_system" version = "0.0.0" dependencies = [ - "hashbrown 0.15.5", + "hashbrown 0.16.1", "parking_lot", "rustc_abi", "rustc_ast", diff --git a/compiler/rustc_data_structures/Cargo.toml b/compiler/rustc_data_structures/Cargo.toml index c8296e05f6bd4..f358ffffb47d1 100644 --- a/compiler/rustc_data_structures/Cargo.toml +++ b/compiler/rustc_data_structures/Cargo.toml @@ -10,7 +10,7 @@ bitflags = "2.4.1" either = "1.0" elsa = "1.11.0" ena = "0.14.3" -indexmap = "2.4.0" +indexmap = "2.12.1" jobserver_crate = { version = "0.1.28", package = "jobserver" } measureme = "12.0.1" parking_lot = "0.12" @@ -31,7 +31,7 @@ tracing = "0.1" # tidy-alphabetical-end [dependencies.hashbrown] -version = "0.15.2" +version = "0.16.1" default-features = false features = ["nightly"] # for may_dangle diff --git a/compiler/rustc_mir_transform/Cargo.toml b/compiler/rustc_mir_transform/Cargo.toml index 6df7a869ca28d..22de197d374a9 100644 --- a/compiler/rustc_mir_transform/Cargo.toml +++ b/compiler/rustc_mir_transform/Cargo.toml @@ -6,7 +6,7 @@ edition = "2024" [dependencies] # tidy-alphabetical-start either = "1" -hashbrown = "0.15" +hashbrown = { version = "0.16.1", default-features = false } itertools = "0.12" rustc_abi = { path = "../rustc_abi" } rustc_arena = { path = "../rustc_arena" } diff --git a/compiler/rustc_query_system/Cargo.toml b/compiler/rustc_query_system/Cargo.toml index 7480ba03474f9..73ab03576dec8 100644 --- a/compiler/rustc_query_system/Cargo.toml +++ b/compiler/rustc_query_system/Cargo.toml @@ -25,6 +25,6 @@ tracing = "0.1" # tidy-alphabetical-end [dependencies.hashbrown] -version = "0.15.2" +version = "0.16.1" default-features = false features = ["nightly"] # for may_dangle diff --git a/src/bootstrap/src/utils/proc_macro_deps.rs b/src/bootstrap/src/utils/proc_macro_deps.rs index 71b6aacdebedd..f1bf6e399fb1a 100644 --- a/src/bootstrap/src/utils/proc_macro_deps.rs +++ b/src/bootstrap/src/utils/proc_macro_deps.rs @@ -22,6 +22,7 @@ pub static CRATES: &[&str] = &[ "fluent-langneg", "fluent-syntax", "fnv", + "foldhash", "generic-array", "hashbrown", "heck", From afa2260a9cea4592606353895e0f8eee88356198 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 13 Jan 2026 10:54:39 -0800 Subject: [PATCH 2/3] library: finish unspecializing `Copy` --- library/core/src/marker.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index 68f5649210de0..da7ba167ef74e 100644 --- a/library/core/src/marker.rs +++ b/library/core/src/marker.rs @@ -455,9 +455,6 @@ marker_impls! { /// [impls]: #implementors #[stable(feature = "rust1", since = "1.0.0")] #[lang = "copy"] -// This is unsound, but required by `hashbrown` -// FIXME(joboet): change `hashbrown` to use `TrivialClone` -#[rustc_unsafe_specialization_marker] #[rustc_diagnostic_item = "Copy"] pub trait Copy: Clone { // Empty. From 03cc50fc57424001285b72c02af2e19f36aabfd5 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 13 Jan 2026 15:23:59 -0800 Subject: [PATCH 3/3] update to indexmap v2.13.0 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 45d01c486faf3..4297c1b32e351 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1953,9 +1953,9 @@ checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5" [[package]] name = "indexmap" -version = "2.12.1" +version = "2.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" dependencies = [ "equivalent", "hashbrown 0.16.1",