@@ -684,26 +684,11 @@ where
684
684
impl_stable_traits_for_trivial_type ! ( :: std:: path:: Path ) ;
685
685
impl_stable_traits_for_trivial_type ! ( :: std:: path:: PathBuf ) ;
686
686
687
- impl < K , V , R , HCX > HashStable < HCX > for :: std:: collections:: HashMap < K , V , R >
688
- where
689
- K : ToStableHashKey < HCX > + Eq ,
690
- V : HashStable < HCX > ,
691
- R : BuildHasher ,
692
- {
693
- #[ inline]
694
- fn hash_stable ( & self , hcx : & mut HCX , hasher : & mut StableHasher ) {
695
- stable_hash_reduce ( hcx, hasher, self . iter ( ) , self . len ( ) , |hasher, hcx, ( key, value) | {
696
- let key = key. to_stable_hash_key ( hcx) ;
697
- key. hash_stable ( hcx, hasher) ;
698
- value. hash_stable ( hcx, hasher) ;
699
- } ) ;
700
- }
701
- }
702
-
703
- // It is not safe to implement HashStable for HashSet or any other collection type
687
+ // It is not safe to implement HashStable for HashSet, HashMap or any other collection type
704
688
// with unstable but observable iteration order.
705
689
// See https://github.com/rust-lang/compiler-team/issues/533 for further information.
706
690
impl < V , HCX > !HashStable < HCX > for std:: collections:: HashSet < V > { }
691
+ impl < K , V , HCX > !HashStable < HCX > for std:: collections:: HashMap < K , V > { }
707
692
708
693
impl < K , V , HCX > HashStable < HCX > for :: std:: collections:: BTreeMap < K , V >
709
694
where
@@ -730,35 +715,6 @@ where
730
715
}
731
716
}
732
717
733
- fn stable_hash_reduce < HCX , I , C , F > (
734
- hcx : & mut HCX ,
735
- hasher : & mut StableHasher ,
736
- mut collection : C ,
737
- length : usize ,
738
- hash_function : F ,
739
- ) where
740
- C : Iterator < Item = I > ,
741
- F : Fn ( & mut StableHasher , & mut HCX , I ) ,
742
- {
743
- length. hash_stable ( hcx, hasher) ;
744
-
745
- match length {
746
- 1 => {
747
- hash_function ( hasher, hcx, collection. next ( ) . unwrap ( ) ) ;
748
- }
749
- _ => {
750
- let hash = collection
751
- . map ( |value| {
752
- let mut hasher = StableHasher :: new ( ) ;
753
- hash_function ( & mut hasher, hcx, value) ;
754
- hasher. finish :: < Hash128 > ( )
755
- } )
756
- . reduce ( |accum, value| accum. wrapping_add ( value) ) ;
757
- hash. hash_stable ( hcx, hasher) ;
758
- }
759
- }
760
- }
761
-
762
718
/// Controls what data we do or do not hash.
763
719
/// Whenever a `HashStable` implementation caches its
764
720
/// result, it needs to include `HashingControls` as part
0 commit comments