Skip to content

Commit 2d7bbda

Browse files
committed
Implement HashStable directly.
1 parent 222d010 commit 2d7bbda

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

src/librustc/dep_graph/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -184,5 +184,3 @@ fn def_id_corresponds_to_hir_dep_node(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
184184
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
185185
def_id.index == hir_id.owner.local_def_index
186186
}
187-
188-
impl rustc_query_system::HashStableContext for StableHashingContext<'_> {}

src/librustc_query_system/dep_graph/dep_node.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ use super::{DepContext, DepKind};
4646

4747
use rustc_data_structures::fingerprint::Fingerprint;
4848
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
49-
use rustc_macros::HashStable_Generic;
5049

5150
use std::fmt;
5251
use std::hash::Hash;
@@ -127,7 +126,6 @@ where
127126
/// the need to be mapped or unmapped. (This ensures we can serialize
128127
/// them even in the absence of a tcx.)
129128
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]
130-
#[derive(HashStable_Generic)]
131129
pub struct WorkProductId {
132130
hash: Fingerprint,
133131
}
@@ -144,3 +142,10 @@ impl WorkProductId {
144142
WorkProductId { hash: fingerprint }
145143
}
146144
}
145+
146+
impl<HCX> HashStable<HCX> for WorkProductId {
147+
#[inline]
148+
fn hash_stable(&self, hcx: &mut HCX, hasher: &mut StableHasher) {
149+
self.hash.hash_stable(hcx, hasher)
150+
}
151+
}

src/librustc_query_system/dep_graph/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use std::hash::Hash;
2222

2323
pub trait DepContext: Copy {
2424
type DepKind: self::DepKind;
25-
type StableHashingContext: crate::HashStableContext;
25+
type StableHashingContext;
2626

2727
/// Create a hashing context for hashing new results.
2828
fn create_stable_hashing_context(&self) -> Self::StableHashingContext;

src/librustc_query_system/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,3 @@ extern crate rustc_data_structures;
1515

1616
pub mod dep_graph;
1717
pub mod query;
18-
19-
pub trait HashStableContext {}

0 commit comments

Comments
 (0)