Do not implement HashStable for HashSet. · rust-lang/rust@b79f026 (original) (raw)

`@@ -617,18 +617,10 @@ where

`

617

617

`}

`

618

618

`}

`

619

619

``

620

``

`-

impl<K, R, HCX> HashStable for ::std::collections::HashSet<K, R>

`

621

``

`-

where

`

622

``

`-

K: ToStableHashKey + Eq,

`

623

``

`-

R: BuildHasher,

`

624

``

`-

{

`

625

``

`-

fn hash_stable(&self, hcx: &mut HCX, hasher: &mut StableHasher) {

`

626

``

`-

stable_hash_reduce(hcx, hasher, self.iter(), self.len(), |hasher, hcx, key| {

`

627

``

`-

let key = key.to_stable_hash_key(hcx);

`

628

``

`-

key.hash_stable(hcx, hasher);

`

629

``

`-

});

`

630

``

`-

}

`

631

``

`-

}

`

``

620

`+

// It is not safe to implement HashStable for HashSet or any other collection type

`

``

621

`+

// with unstable but observable iteration order.

`

``

622

`+

// See https://github.com/rust-lang/compiler-team/issues/533 for further information.

`

``

623

`+

impl<V, HCX> !HashStable for std::collections::HashSet {}

`

632

624

``

633

625

`impl<K, V, HCX> HashStable for ::std::collections::BTreeMap<K, V>

`

634

626

`where

`