diff options
Diffstat (limited to 'src/librustc_data_structures/stable_hasher.rs')
| -rw-r--r-- | src/librustc_data_structures/stable_hasher.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/librustc_data_structures/stable_hasher.rs b/src/librustc_data_structures/stable_hasher.rs index 19343a9250d..c777f1fa829 100644 --- a/src/librustc_data_structures/stable_hasher.rs +++ b/src/librustc_data_structures/stable_hasher.rs @@ -1,6 +1,7 @@ use std::hash::{Hash, Hasher, BuildHasher}; use std::marker::PhantomData; use std::mem; +use smallvec::SmallVec; use crate::sip128::SipHasher128; use crate::indexed_vec; use crate::bit_set; @@ -318,6 +319,17 @@ impl<T: HashStable<CTX>, CTX> HashStable<CTX> for Vec<T> { } } +impl<A, CTX> HashStable<CTX> for SmallVec<[A; 1]> where A: HashStable<CTX> { + #[inline] + fn hash_stable<W: StableHasherResult>(&self, + ctx: &mut CTX, + hasher: &mut StableHasher<W>) { + for item in self { + item.hash_stable(ctx, hasher); + } + } +} + impl<T: ?Sized + HashStable<CTX>, CTX> HashStable<CTX> for Box<T> { #[inline] fn hash_stable<W: StableHasherResult>(&self, |
