diff --git a/compiler/rustc_data_structures/src/stable_hasher.rs b/compiler/rustc_data_structures/src/stable_hasher.rs index e0d77cdaebb36..de9842156d61f 100644 --- a/compiler/rustc_data_structures/src/stable_hasher.rs +++ b/compiler/rustc_data_structures/src/stable_hasher.rs @@ -617,18 +617,10 @@ where } } -impl HashStable for ::std::collections::HashSet -where - K: ToStableHashKey + Eq, - R: BuildHasher, -{ - 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); - }); - } -} +// It is not safe to implement HashStable for HashSet or any other collection type +// with unstable but observable iteration order. +// See https://github.com/rust-lang/compiler-team/issues/533 for further information. +impl !HashStable for std::collections::HashSet {} impl HashStable for ::std::collections::BTreeMap where