Use uplifted `rustc-stable-hash` crate in `rustc_data_structures` · rust-lang/rust@977439d

11 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -3514,6 +3514,12 @@ 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 = "registry+https://github.com/rust-lang/crates.io-index"

3521+

checksum = "e5c9f15eec8235d7cb775ee6f81891db79b98fd54ba1ad8fae565b88ef1ae4e2"

3522+
35173523

[[package]]

35183524

name = "rustc-std-workspace-alloc"

35193525

version = "1.99.0"

@@ -3852,6 +3858,7 @@ dependencies = [

38523858

"portable-atomic",

38533859

"rustc-hash",

38543860

"rustc-rayon",

3861+

"rustc-stable-hash",

38553862

"rustc_arena",

38563863

"rustc_graphviz",

38573864

"rustc_index",

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 = { version = "0.1.0", features = ["nightly"] }

1819

rustc_arena = { path = "../rustc_arena" }

1920

rustc_graphviz = { path = "../rustc_graphviz" }

2021

rustc_index = { path = "../rustc_index", package = "rustc_index" }

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::{FromStableHash, Hash64, StableHasherHash};

33

use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};

44

use std::hash::{Hash, Hasher};

55

@@ -154,10 +154,11 @@ impl FingerprintHasher for crate::unhash::Unhasher {

154154

}

155155

}

156156
157-

impl StableHasherResult for Fingerprint {

157+

impl FromStableHash for Fingerprint {

158+

type Hash = StableHasherHash;

159+
158160

#[inline]

159-

fn finish(hasher: StableHasher) -> Self {

160-

let (_0, _1) = hasher.finalize();

161+

fn from(StableHasherHash([_0, _1]): Self::Hash) -> Self {

161162

Fingerprint(_0, _1)

162163

}

163164

}

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::{FromStableHash, StableHasherHash};

1515

use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};

1616

use std::fmt;

1717

use std::ops::BitXorAssign;

@@ -56,10 +56,12 @@ impl<D: Decoder> Decodable<D> for Hash64 {

5656

}

5757

}

5858
59-

impl StableHasherResult for Hash64 {

59+

impl FromStableHash for Hash64 {

60+

type Hash = StableHasherHash;

61+
6062

#[inline]

61-

fn finish(hasher: StableHasher) -> Self {

62-

Self { inner: hasher.finalize().0 }

63+

fn from(StableHasherHash([_0, __1]): Self::Hash) -> Self {

64+

Self { inner: _0 }

6365

}

6466

}

6567

@@ -121,10 +123,11 @@ impl<D: Decoder> Decodable<D> for Hash128 {

121123

}

122124

}

123125
124-

impl StableHasherResult for Hash128 {

126+

impl FromStableHash for Hash128 {

127+

type Hash = StableHasherHash;

128+
125129

#[inline]

126-

fn finish(hasher: StableHasher) -> Self {

127-

let (_0, _1) = hasher.finalize();

130+

fn from(StableHasherHash([_0, _1]): Self::Hash) -> Self {

128131

Self { inner: u128::from(_0) | (u128::from(_1) << 64) }

129132

}

130133

}

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;