Skip to content

Commit 0511dbb

Browse files
committed
Auto merge of rust-lang#134434 - lukas-code:proc_macro-hash-v2, r=<try>
`proc_macro`: add dependency on `rustc-hash` and update to 2.0 let's see if this affects perf at all... `rustc-hash` diff: rust-lang/rustc-hash@master...lukas-code:rustc-hash:dep-of-std r? ghost
2 parents f23a80a + 51749d0 commit 0511dbb

File tree

7 files changed

+21
-118
lines changed

7 files changed

+21
-118
lines changed

library/Cargo.lock

+11
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ name = "proc_macro"
227227
version = "0.0.0"
228228
dependencies = [
229229
"core",
230+
"rustc-hash",
230231
"std",
231232
]
232233

@@ -292,6 +293,16 @@ dependencies = [
292293
"rustc-std-workspace-core",
293294
]
294295

296+
[[package]]
297+
name = "rustc-hash"
298+
version = "2.2.0"
299+
source = "git+https://github.com/lukas-code/rustc-hash.git?branch=dep-of-std#977dc4d81bc262e3af10ed7f7b80c0d0b9d4406b"
300+
dependencies = [
301+
"compiler_builtins",
302+
"rustc-std-workspace-core",
303+
"rustc-std-workspace-std",
304+
]
305+
295306
[[package]]
296307
name = "rustc-std-workspace-alloc"
297308
version = "1.99.0"

library/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,5 @@ rustc-demangle.debug = 0
4545
rustc-std-workspace-core = { path = 'rustc-std-workspace-core' }
4646
rustc-std-workspace-alloc = { path = 'rustc-std-workspace-alloc' }
4747
rustc-std-workspace-std = { path = 'rustc-std-workspace-std' }
48+
49+
rustc-hash = { git = "https://github.com/lukas-code/rustc-hash.git", branch = "dep-of-std" }

library/proc_macro/Cargo.toml

+5
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,8 @@ std = { path = "../std" }
99
# `core` when resolving doc links. Without this line a different `core` will be
1010
# loaded from sysroot causing duplicate lang items and other similar errors.
1111
core = { path = "../core" }
12+
13+
[dependencies.rustc-hash]
14+
version = "2.2.0"
15+
default-features = false
16+
features = ["rustc-dep-of-std"]

library/proc_macro/src/bridge/fxhash.rs

-113
This file was deleted.

library/proc_macro/src/bridge/handle.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::num::NonZero;
66
use std::ops::{Index, IndexMut};
77
use std::sync::atomic::{AtomicU32, Ordering};
88

9-
use super::fxhash::FxHashMap;
9+
use rustc_hash::FxHashMap;
1010

1111
pub(super) type Handle = NonZero<u32>;
1212

library/proc_macro/src/bridge/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,6 @@ pub mod client;
155155
#[allow(unsafe_code)]
156156
mod closure;
157157
#[forbid(unsafe_code)]
158-
mod fxhash;
159-
#[forbid(unsafe_code)]
160158
mod handle;
161159
#[macro_use]
162160
#[forbid(unsafe_code)]

library/proc_macro/src/bridge/symbol.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl<S> DecodeMut<'_, '_, S> for Symbol {
128128
thread_local! {
129129
static INTERNER: RefCell<Interner> = RefCell::new(Interner {
130130
arena: arena::Arena::new(),
131-
names: fxhash::FxHashMap::default(),
131+
names: rustc_hash::FxHashMap::default(),
132132
strings: Vec::new(),
133133
// Start with a base of 1 to make sure that `NonZero<u32>` works.
134134
sym_base: NonZero::new(1).unwrap(),
@@ -141,7 +141,7 @@ struct Interner {
141141
// SAFETY: These `'static` lifetimes are actually references to data owned
142142
// by the Arena. This is safe, as we never return them as static references
143143
// from `Interner`.
144-
names: fxhash::FxHashMap<&'static str, Symbol>,
144+
names: rustc_hash::FxHashMap<&'static str, Symbol>,
145145
strings: Vec<&'static str>,
146146
// The offset to apply to symbol names stored in the interner. This is used
147147
// to ensure that symbol names are not re-used after the interner is

0 commit comments

Comments
 (0)