diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2018-12-03 01:14:35 +0100 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2019-03-13 00:03:13 +0100 |
| commit | 3936aff2169a1f61633de2bc475face3a2682efb (patch) | |
| tree | 0acd56359a94980bef3519e0d39123e8d0d4a8af /src/librustc_data_structures/thin_vec.rs | |
| parent | 48757a70a382afe27d5469fdcfbe5d434c9d4097 (diff) | |
| download | rust-3936aff2169a1f61633de2bc475face3a2682efb.tar.gz rust-3936aff2169a1f61633de2bc475face3a2682efb.zip | |
Use derive macro for HashStable
Diffstat (limited to 'src/librustc_data_structures/thin_vec.rs')
| -rw-r--r-- | src/librustc_data_structures/thin_vec.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/librustc_data_structures/thin_vec.rs b/src/librustc_data_structures/thin_vec.rs index ed57c528f51..52f23f4893e 100644 --- a/src/librustc_data_structures/thin_vec.rs +++ b/src/librustc_data_structures/thin_vec.rs @@ -1,3 +1,5 @@ +use crate::stable_hasher::{StableHasher, StableHasherResult, HashStable}; + /// A vector type optimized for cases where this size is usually 0 (cf. `SmallVector`). /// The `Option<Box<..>>` wrapping allows us to represent a zero sized vector with `None`, /// which uses only a single (null) pointer. @@ -56,3 +58,11 @@ impl<T> Extend<T> for ThinVec<T> { } } } + +impl<T: HashStable<CTX>, CTX> HashStable<CTX> for ThinVec<T> { + fn hash_stable<W: StableHasherResult>(&self, + hcx: &mut CTX, + hasher: &mut StableHasher<W>) { + (**self).hash_stable(hcx, hasher) + } +} |
