Do not implement HashStable for HashSet.
This commit is contained in:
parent
04e5fa3ce2
commit
b79f0261f8
1 changed files with 4 additions and 12 deletions
|
@ -617,18 +617,10 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<K, R, HCX> HashStable<HCX> for ::std::collections::HashSet<K, R>
|
// It is not safe to implement HashStable for HashSet or any other collection type
|
||||||
where
|
// with unstable but observable iteration order.
|
||||||
K: ToStableHashKey<HCX> + Eq,
|
// See https://github.com/rust-lang/compiler-team/issues/533 for further information.
|
||||||
R: BuildHasher,
|
impl<V, HCX> !HashStable<HCX> for std::collections::HashSet<V> {}
|
||||||
{
|
|
||||||
fn hash_stable(&self, hcx: &mut HCX, hasher: &mut StableHasher) {
|
|
||||||
stable_hash_reduce(hcx, hasher, self.iter(), self.len(), |hasher, hcx, key| {
|
|
||||||
let key = key.to_stable_hash_key(hcx);
|
|
||||||
key.hash_stable(hcx, hasher);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<K, V, HCX> HashStable<HCX> for ::std::collections::BTreeMap<K, V>
|
impl<K, V, HCX> HashStable<HCX> for ::std::collections::BTreeMap<K, V>
|
||||||
where
|
where
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue