diff options
| author | Michael Woerister <michaelwoerister@posteo.net> | 2017-03-30 15:27:27 +0200 |
|---|---|---|
| committer | Michael Woerister <michaelwoerister@posteo.net> | 2017-04-06 16:01:51 +0200 |
| commit | c47cdc0d93726429ee18b418b1f85fae67b82d41 (patch) | |
| tree | fd593b85d26b0f7d4dabef775fbb30521d575282 /src/libsyntax/util | |
| parent | 9e84bf8096b71a731a65045120b65db72df24137 (diff) | |
| download | rust-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.rs | 13 |
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); + } +} |
