diff --git a/Cargo.lock b/Cargo.lock index 8fec4bf128f7e..8e703c28e0035 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1578,6 +1578,12 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35" +[[package]] +name = "highway" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66920f2e905206a4aca271ae71f1638f10854e3739f162fc465fb8aecce44446" + [[package]] name = "home" version = "0.5.3" @@ -3845,6 +3851,7 @@ dependencies = [ "cfg-if 0.1.10", "crossbeam-utils 0.7.2", "ena", + "highway", "indexmap", "jobserver", "libc", diff --git a/compiler/rustc_data_structures/Cargo.toml b/compiler/rustc_data_structures/Cargo.toml index d32598e716e1d..c916668b41398 100644 --- a/compiler/rustc_data_structures/Cargo.toml +++ b/compiler/rustc_data_structures/Cargo.toml @@ -29,6 +29,7 @@ measureme = "9.1.0" libc = "0.2" stacker = "0.1.12" tempfile = "3.0.5" +highway = "0.6.3" [dependencies.parking_lot] version = "0.11" diff --git a/compiler/rustc_data_structures/src/stable_hasher.rs b/compiler/rustc_data_structures/src/stable_hasher.rs index ff28784a1dc42..dd86bc5881839 100644 --- a/compiler/rustc_data_structures/src/stable_hasher.rs +++ b/compiler/rustc_data_structures/src/stable_hasher.rs @@ -1,4 +1,4 @@ -use crate::sip128::SipHasher128; +use highway::{HighwayHash, HighwayHasher, Key}; use rustc_index::bit_set; use rustc_index::vec; use smallvec::SmallVec; @@ -16,7 +16,7 @@ mod tests; /// hashing and the architecture dependent `isize` and `usize` types are /// extended to 64 bits if needed. pub struct StableHasher { - state: SipHasher128, + state: HighwayHasher, } impl ::std::fmt::Debug for StableHasher { @@ -32,7 +32,7 @@ pub trait StableHasherResult: Sized { impl StableHasher { #[inline] pub fn new() -> Self { - StableHasher { state: SipHasher128::new_with_keys(0, 0) } + StableHasher { state: HighwayHasher::new(Key([0, 0, 0, 0])) } } #[inline] @@ -50,14 +50,15 @@ impl StableHasherResult for u128 { impl StableHasherResult for u64 { fn finish(hasher: StableHasher) -> Self { - hasher.finalize().0 + hasher.state.finalize64() } } impl StableHasher { #[inline] pub fn finalize(self) -> (u64, u64) { - self.state.finish128() + let [first, second] = self.state.finalize128(); + (first, second) } } @@ -68,7 +69,7 @@ impl Hasher for StableHasher { #[inline] fn write(&mut self, bytes: &[u8]) { - self.state.write(bytes); + self.state.append(bytes); } #[inline] diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index 51f48d8f2ecc7..e5e8396f1e1a6 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -105,6 +105,7 @@ const PERMITTED_DEPENDENCIES: &[&str] = &[ "gsgdt", "hashbrown", "hermit-abi", + "highway", "humantime", "indexmap", "instant",