Skip to content

Commit 22a9c26

Browse files
committed
Auto merge of #127479 - Urgau:rustc-stable-hash, r=<try>
Use rustc-stable-hash in the compiler cc `@michaelwoerister` r? ghost
2 parents 7fdefb8 + 56e0384 commit 22a9c26

File tree

11 files changed

+22
-1043
lines changed

11 files changed

+22
-1043
lines changed

Cargo.lock

+6
Original file line numberDiff line numberDiff line change
@@ -3514,6 +3514,11 @@ version = "1.1.0"
35143514
source = "registry+https://github.com/rust-lang/crates.io-index"
35153515
checksum = "5be1bdc7edf596692617627bbfeaba522131b18e06ca4df2b6b689e3c5d5ce84"
35163516

3517+
[[package]]
3518+
name = "rustc-stable-hash"
3519+
version = "0.1.0"
3520+
source = "git+https://github.com/rust-lang/rustc-stable-hash?rev=refs/pull/8/head#f2780d22c5370b430fb44848c4e12c636a5fee60"
3521+
35173522
[[package]]
35183523
name = "rustc-std-workspace-alloc"
35193524
version = "1.99.0"
@@ -3852,6 +3857,7 @@ dependencies = [
38523857
"portable-atomic",
38533858
"rustc-hash",
38543859
"rustc-rayon",
3860+
"rustc-stable-hash",
38553861
"rustc_arena",
38563862
"rustc_graphviz",
38573863
"rustc_index",

compiler/rustc_data_structures/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobserver_crate = { version = "0.1.28", package = "jobserver" }
1515
measureme = "11"
1616
rustc-hash = "1.1.0"
1717
rustc-rayon = { version = "0.5.0", optional = true }
18+
rustc-stable-hash = { git = "https://github.com/rust-lang/rustc-stable-hash", rev = "refs/pull/8/head", features = ["nightly"] }
1819
rustc_arena = { path = "../rustc_arena" }
1920
rustc_graphviz = { path = "../rustc_graphviz" }
2021
rustc_index = { path = "../rustc_index", package = "rustc_index" }

compiler/rustc_data_structures/src/fingerprint.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::stable_hasher::impl_stable_traits_for_trivial_type;
2-
use crate::stable_hasher::{Hash64, StableHasher, StableHasherResult};
2+
use crate::stable_hasher::{Hash64, StableHasherResult};
33
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
44
use std::hash::{Hash, Hasher};
55

@@ -155,9 +155,10 @@ impl FingerprintHasher for crate::unhash::Unhasher {
155155
}
156156

157157
impl StableHasherResult for Fingerprint {
158+
type Hash = [u64; 2];
159+
158160
#[inline]
159-
fn finish(hasher: StableHasher) -> Self {
160-
let (_0, _1) = hasher.finalize();
161+
fn finish([_0, _1]: Self::Hash) -> Self {
161162
Fingerprint(_0, _1)
162163
}
163164
}

compiler/rustc_data_structures/src/hashes.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//! connect the fact that they can only be produced by a `StableHasher` to their
1212
//! `Encode`/`Decode` impls.
1313
14-
use crate::stable_hasher::{StableHasher, StableHasherResult};
14+
use crate::stable_hasher::StableHasherResult;
1515
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
1616
use std::fmt;
1717
use std::ops::BitXorAssign;
@@ -57,9 +57,11 @@ impl<D: Decoder> Decodable<D> for Hash64 {
5757
}
5858

5959
impl StableHasherResult for Hash64 {
60+
type Hash = [u64; 2];
61+
6062
#[inline]
61-
fn finish(hasher: StableHasher) -> Self {
62-
Self { inner: hasher.finalize().0 }
63+
fn finish([_0, __1]: Self::Hash) -> Self {
64+
Self { inner: _0 }
6365
}
6466
}
6567

@@ -122,9 +124,10 @@ impl<D: Decoder> Decodable<D> for Hash128 {
122124
}
123125

124126
impl StableHasherResult for Hash128 {
127+
type Hash = [u64; 2];
128+
125129
#[inline]
126-
fn finish(hasher: StableHasher) -> Self {
127-
let (_0, _1) = hasher.finalize();
130+
fn finish([_0, _1]: Self::Hash) -> Self {
128131
Self { inner: u128::from(_0) | (u128::from(_1) << 64) }
129132
}
130133
}

compiler/rustc_data_structures/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#![feature(core_intrinsics)]
2525
#![feature(extend_one)]
2626
#![feature(hash_raw_entry)]
27-
#![feature(hasher_prefixfree_extras)]
2827
#![feature(macro_metavar_expr)]
2928
#![feature(map_try_insert)]
3029
#![feature(min_specialization)]
@@ -67,7 +66,6 @@ pub mod owned_slice;
6766
pub mod packed;
6867
pub mod profiling;
6968
pub mod sharded;
70-
pub mod sip128;
7169
pub mod small_c_str;
7270
pub mod snapshot_map;
7371
pub mod sorted_map;

0 commit comments

Comments
 (0)