about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2020-03-27 08:33:37 +0100
committerCamille GILLOT <gillot.camille@gmail.com>2020-03-27 08:33:37 +0100
commit2d7bbda966744f5eff12135bb523ac9c1d561cf0 (patch)
tree71ece4490283c7d2b370742f5fc29ceb43fef819
parent222d01025581174b4f6c1afacf673bc6eade3a6a (diff)
downloadrust-2d7bbda966744f5eff12135bb523ac9c1d561cf0.tar.gz
rust-2d7bbda966744f5eff12135bb523ac9c1d561cf0.zip
Implement HashStable directly.
-rw-r--r--src/librustc/dep_graph/mod.rs2
-rw-r--r--src/librustc_query_system/dep_graph/dep_node.rs9
-rw-r--r--src/librustc_query_system/dep_graph/mod.rs2
-rw-r--r--src/librustc_query_system/lib.rs2
4 files changed, 8 insertions, 7 deletions
diff --git a/src/librustc/dep_graph/mod.rs b/src/librustc/dep_graph/mod.rs
index 7b05a575b93..f56df19bfb0 100644
--- a/src/librustc/dep_graph/mod.rs
+++ b/src/librustc/dep_graph/mod.rs
@@ -184,5 +184,3 @@ fn def_id_corresponds_to_hir_dep_node(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
     let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
     def_id.index == hir_id.owner.local_def_index
 }
-
-impl rustc_query_system::HashStableContext for StableHashingContext<'_> {}
diff --git a/src/librustc_query_system/dep_graph/dep_node.rs b/src/librustc_query_system/dep_graph/dep_node.rs
index c6fff2f0164..b1d332da115 100644
--- a/src/librustc_query_system/dep_graph/dep_node.rs
+++ b/src/librustc_query_system/dep_graph/dep_node.rs
@@ -46,7 +46,6 @@ use super::{DepContext, DepKind};
 
 use rustc_data_structures::fingerprint::Fingerprint;
 use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
-use rustc_macros::HashStable_Generic;
 
 use std::fmt;
 use std::hash::Hash;
@@ -127,7 +126,6 @@ where
 /// the need to be mapped or unmapped. (This ensures we can serialize
 /// them even in the absence of a tcx.)
 #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]
-#[derive(HashStable_Generic)]
 pub struct WorkProductId {
     hash: Fingerprint,
 }
@@ -144,3 +142,10 @@ impl WorkProductId {
         WorkProductId { hash: fingerprint }
     }
 }
+
+impl<HCX> HashStable<HCX> for WorkProductId {
+    #[inline]
+    fn hash_stable(&self, hcx: &mut HCX, hasher: &mut StableHasher) {
+        self.hash.hash_stable(hcx, hasher)
+    }
+}
diff --git a/src/librustc_query_system/dep_graph/mod.rs b/src/librustc_query_system/dep_graph/mod.rs
index 232efa8795d..fbc91575ede 100644
--- a/src/librustc_query_system/dep_graph/mod.rs
+++ b/src/librustc_query_system/dep_graph/mod.rs
@@ -22,7 +22,7 @@ use std::hash::Hash;
 
 pub trait DepContext: Copy {
     type DepKind: self::DepKind;
-    type StableHashingContext: crate::HashStableContext;
+    type StableHashingContext;
 
     /// Create a hashing context for hashing new results.
     fn create_stable_hashing_context(&self) -> Self::StableHashingContext;
diff --git a/src/librustc_query_system/lib.rs b/src/librustc_query_system/lib.rs
index 6623e74b5cb..0e6a07e06d0 100644
--- a/src/librustc_query_system/lib.rs
+++ b/src/librustc_query_system/lib.rs
@@ -15,5 +15,3 @@ extern crate rustc_data_structures;
 
 pub mod dep_graph;
 pub mod query;
-
-pub trait HashStableContext {}