33use std:: hash:: { Hash , Hasher } ;
44
55use rustc_index:: { Idx , IndexVec } ;
6-
7- use crate :: stable_hasher:: { HashStable , StableHasher } ;
6+ use rustc_macros:: HashStable_NoContext ;
87
98/// An indexed multi-map that preserves insertion order while permitting both *O*(log *n*) lookup of
109/// an item by key and *O*(1) lookup by index.
@@ -24,11 +23,13 @@ use crate::stable_hasher::{HashStable, StableHasher};
2423/// in-place.
2524///
2625/// [`SortedMap`]: super::SortedMap
27- #[ derive( Clone , Debug ) ]
26+ #[ derive( Clone , Debug , HashStable_NoContext ) ]
2827pub struct SortedIndexMultiMap < I : Idx , K , V > {
2928 /// The elements of the map in insertion order.
3029 items : IndexVec < I , ( K , V ) > ,
3130
31+ // We can ignore this field because it is not observable from the outside.
32+ #[ stable_hasher( ignore) ]
3233 /// Indices of the items in the set, sorted by the item's key.
3334 idx_sorted_by_item_key : Vec < I > ,
3435}
@@ -126,22 +127,6 @@ where
126127 }
127128}
128129
129- impl < I : Idx , K , V , C > HashStable < C > for SortedIndexMultiMap < I , K , V >
130- where
131- K : HashStable < C > ,
132- V : HashStable < C > ,
133- {
134- fn hash_stable ( & self , ctx : & mut C , hasher : & mut StableHasher ) {
135- let SortedIndexMultiMap {
136- items,
137- // We can ignore this field because it is not observable from the outside.
138- idx_sorted_by_item_key : _,
139- } = self ;
140-
141- items. hash_stable ( ctx, hasher)
142- }
143- }
144-
145130impl < I : Idx , K : Ord , V > FromIterator < ( K , V ) > for SortedIndexMultiMap < I , K , V > {
146131 fn from_iter < J > ( iter : J ) -> Self
147132 where
0 commit comments