diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2021-05-11 10:38:54 +0200 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2021-05-30 19:54:21 +0200 |
| commit | ee567fe1b1188077743263bebfefc3d2b7cdbcd2 (patch) | |
| tree | 03c3f9e6c0bf0d0f1abb769af2b31aee3266224c /compiler/rustc_data_structures/src | |
| parent | 10fb4b2fe538df29ee9729f060db0ca74f6c28fb (diff) | |
| download | rust-ee567fe1b1188077743263bebfefc3d2b7cdbcd2.tar.gz rust-ee567fe1b1188077743263bebfefc3d2b7cdbcd2.zip | |
Remove StableVec.
Diffstat (limited to 'compiler/rustc_data_structures/src')
| -rw-r--r-- | compiler/rustc_data_structures/src/stable_hasher.rs | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/compiler/rustc_data_structures/src/stable_hasher.rs b/compiler/rustc_data_structures/src/stable_hasher.rs index ff28784a1dc..18b352cf3b0 100644 --- a/compiler/rustc_data_structures/src/stable_hasher.rs +++ b/compiler/rustc_data_structures/src/stable_hasher.rs @@ -550,35 +550,3 @@ pub fn hash_stable_hashmap<HCX, K, V, R, SK, F>( entries.sort_unstable_by(|&(ref sk1, _), &(ref sk2, _)| sk1.cmp(sk2)); entries.hash_stable(hcx, hasher); } - -/// A vector container that makes sure that its items are hashed in a stable -/// order. -#[derive(Debug)] -pub struct StableVec<T>(Vec<T>); - -impl<T> StableVec<T> { - pub fn new(v: Vec<T>) -> Self { - StableVec(v) - } -} - -impl<T> ::std::ops::Deref for StableVec<T> { - type Target = Vec<T>; - - fn deref(&self) -> &Vec<T> { - &self.0 - } -} - -impl<T, HCX> HashStable<HCX> for StableVec<T> -where - T: HashStable<HCX> + ToStableHashKey<HCX>, -{ - fn hash_stable(&self, hcx: &mut HCX, hasher: &mut StableHasher) { - let StableVec(ref v) = *self; - - let mut sorted: Vec<_> = v.iter().map(|x| x.to_stable_hash_key(hcx)).collect(); - sorted.sort_unstable(); - sorted.hash_stable(hcx, hasher); - } -} |
