Skip to content

Commit 6b61fd1

Browse files
author
Lukas Markeffsky
committed
proc_macro: add dependency on rustc_hash and update to 2.0
1 parent 604d669 commit 6b61fd1

File tree

7 files changed

+21
-118
lines changed

7 files changed

+21
-118
lines changed

library/Cargo.lock

+10
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,15 @@ 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#893c45b6a827d3cc6ecfa0c04830793f7a960d84"
300+
dependencies = [
301+
"rustc-std-workspace-core",
302+
"rustc-std-workspace-std",
303+
]
304+
295305
[[package]]
296306
name = "rustc-std-workspace-alloc"
297307
version = "1.99.0"

library/proc_macro/Cargo.toml

+7
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,10 @@ 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+
git = "https://github.com/lukas-code/rustc-hash.git"
16+
branch = "dep-of-std"
17+
default-features = false
18+
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

src/tools/tidy/src/deps.rs

+1
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ const PERMITTED_STDLIB_DEPENDENCIES: &[&str] = &[
479479
"rand_core",
480480
"rand_xorshift",
481481
"rustc-demangle",
482+
"rustc-hash",
482483
"shlex",
483484
"unicode-width",
484485
"unwinding",

0 commit comments

Comments
 (0)