about summary refs log tree commit diff
path: root/src/libsyntax/util
diff options
context:
space:
mode:
authorMichael Woerister <michaelwoerister@posteo.net>2017-03-30 15:27:27 +0200
committerMichael Woerister <michaelwoerister@posteo.net>2017-04-06 16:01:51 +0200
commitc47cdc0d93726429ee18b418b1f85fae67b82d41 (patch)
treefd593b85d26b0f7d4dabef775fbb30521d575282 /src/libsyntax/util
parent9e84bf8096b71a731a65045120b65db72df24137 (diff)
downloadrust-c47cdc0d93726429ee18b418b1f85fae67b82d41.tar.gz
rust-c47cdc0d93726429ee18b418b1f85fae67b82d41.zip
Introduce HashStable trait and base ICH implementations on it.
This initial commit provides implementations for HIR, MIR, and
everything that also needs to be supported for those two.
Diffstat (limited to 'src/libsyntax/util')
-rw-r--r--src/libsyntax/util/rc_slice.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libsyntax/util/rc_slice.rs b/src/libsyntax/util/rc_slice.rs
index 195fb23f9d8..2d9fd7aa875 100644
--- a/src/libsyntax/util/rc_slice.rs
+++ b/src/libsyntax/util/rc_slice.rs
@@ -12,6 +12,9 @@ use std::fmt;
 use std::ops::Deref;
 use std::rc::Rc;
 
+use rustc_data_structures::stable_hasher::{StableHasher, StableHasherResult,
+                                           HashStable};
+
 #[derive(Clone)]
 pub struct RcSlice<T> {
     data: Rc<Box<[T]>>,
@@ -41,3 +44,13 @@ impl<T: fmt::Debug> fmt::Debug for RcSlice<T> {
         fmt::Debug::fmt(self.deref(), f)
     }
 }
+
+impl<CTX, T> HashStable<CTX> for RcSlice<T>
+    where T: HashStable<CTX>
+{
+    fn hash_stable<W: StableHasherResult>(&self,
+                                          hcx: &mut CTX,
+                                          hasher: &mut StableHasher<W>) {
+        (**self).hash_stable(hcx, hasher);
+    }
+}