about summary refs log tree commit diff
path: root/src/librustc_data_structures
diff options
context:
space:
mode:
authorMichael Woerister <michaelwoerister@posteo>2017-09-07 16:11:58 +0200
committerMichael Woerister <michaelwoerister@posteo>2017-09-18 11:25:34 +0200
commit3cc3ae22bddc4fb24c790b58700a699c764ebd0e (patch)
tree9c26fff1cf4b5dd83153dd10e78673707f6979a5 /src/librustc_data_structures
parente6c9a53d1a148fe4cd2cf9e0e1329289163d2284 (diff)
downloadrust-3cc3ae22bddc4fb24c790b58700a699c764ebd0e.tar.gz
rust-3cc3ae22bddc4fb24c790b58700a699c764ebd0e.zip
incr.comp.: Move result fingerprinting to DepGraph::with_task().
This makes sure that we don't introduce strange cases where we have
nodes outside the query system that could break red/green tracking
and it will allow to keep red/green neatly encapsulated within the
DepGraph implementation.
Diffstat (limited to 'src/librustc_data_structures')
-rw-r--r--src/librustc_data_structures/stable_hasher.rs28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/librustc_data_structures/stable_hasher.rs b/src/librustc_data_structures/stable_hasher.rs
index 0d0cf672489..f80cbfadf2e 100644
--- a/src/librustc_data_structures/stable_hasher.rs
+++ b/src/librustc_data_structures/stable_hasher.rs
@@ -192,6 +192,28 @@ impl<W> Hasher for StableHasher<W> {
 }
 
 
+/// Something that can provide a stable hashing context.
+pub trait StableHashingContextProvider {
+    type ContextType;
+    fn create_stable_hashing_context(&self) -> Self::ContextType;
+}
+
+impl<'a, T: StableHashingContextProvider> StableHashingContextProvider for &'a T {
+    type ContextType = T::ContextType;
+
+    fn create_stable_hashing_context(&self) -> Self::ContextType {
+        (**self).create_stable_hashing_context()
+    }
+}
+
+impl<'a, T: StableHashingContextProvider> StableHashingContextProvider for &'a mut T {
+    type ContextType = T::ContextType;
+
+    fn create_stable_hashing_context(&self) -> Self::ContextType {
+        (**self).create_stable_hashing_context()
+    }
+}
+
 /// Something that implements `HashStable<CTX>` can be hashed in a way that is
 /// stable across multiple compilation sessions.
 pub trait HashStable<CTX> {
@@ -292,7 +314,7 @@ impl<T: HashStable<CTX>, CTX> HashStable<CTX> for Vec<T> {
     }
 }
 
-impl<T: HashStable<CTX>, CTX> HashStable<CTX> for Box<T> {
+impl<T: ?Sized + HashStable<CTX>, CTX> HashStable<CTX> for Box<T> {
     #[inline]
     fn hash_stable<W: StableHasherResult>(&self,
                                           ctx: &mut CTX,
@@ -301,7 +323,7 @@ impl<T: HashStable<CTX>, CTX> HashStable<CTX> for Box<T> {
     }
 }
 
-impl<T: HashStable<CTX>, CTX> HashStable<CTX> for ::std::rc::Rc<T> {
+impl<T: ?Sized + HashStable<CTX>, CTX> HashStable<CTX> for ::std::rc::Rc<T> {
     #[inline]
     fn hash_stable<W: StableHasherResult>(&self,
                                           ctx: &mut CTX,
@@ -310,7 +332,7 @@ impl<T: HashStable<CTX>, CTX> HashStable<CTX> for ::std::rc::Rc<T> {
     }
 }
 
-impl<T: HashStable<CTX>, CTX> HashStable<CTX> for ::std::sync::Arc<T> {
+impl<T: ?Sized + HashStable<CTX>, CTX> HashStable<CTX> for ::std::sync::Arc<T> {
     #[inline]
     fn hash_stable<W: StableHasherResult>(&self,
                                           ctx: &mut CTX,