]> git.proxmox.com Git - rustc.git/blobdiff - src/libsyntax/util/rc_slice.rs
New upstream version 1.18.0+dfsg1
[rustc.git] / src / libsyntax / util / rc_slice.rs
index 195fb23f9d8c75ed8b8c3f0e4ce1042f207b259b..2d9fd7aa87553dc81ad73bb36f77fc3198ce781a 100644 (file)
@@ -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);
+    }
+}