@@ -132,7 +132,7 @@ pub struct AstIdMap {
132
132
/// Maps stable id to unstable ptr.
133
133
arena : Arena < SyntaxNodePtr > ,
134
134
/// Reverse: map ptr to id.
135
- map : hashbrown:: HashMap < Idx < SyntaxNodePtr > , ( ) , ( ) > ,
135
+ map : hashbrown:: HashTable < Idx < SyntaxNodePtr > > ,
136
136
}
137
137
138
138
impl fmt:: Debug for AstIdMap {
@@ -169,13 +169,13 @@ impl AstIdMap {
169
169
TreeOrder :: DepthFirst
170
170
}
171
171
} ) ;
172
- res. map = hashbrown:: HashMap :: with_capacity_and_hasher ( res. arena . len ( ) , ( ) ) ;
172
+ res. map = hashbrown:: HashTable :: with_capacity ( res. arena . len ( ) ) ;
173
173
for ( idx, ptr) in res. arena . iter ( ) {
174
174
let hash = hash_ptr ( ptr) ;
175
- match res. map . raw_entry_mut ( ) . from_hash ( hash, |idx2| * idx2 == idx) {
176
- hashbrown:: hash_map :: RawEntryMut :: Occupied ( _) => unreachable ! ( ) ,
177
- hashbrown:: hash_map :: RawEntryMut :: Vacant ( entry) => {
178
- entry. insert_with_hasher ( hash , idx, ( ) , | & idx| hash_ptr ( & res . arena [ idx ] ) ) ;
175
+ match res. map . entry ( hash, |& idx2| idx2 == idx, | & idx| hash_ptr ( & res . arena [ idx ] ) ) {
176
+ hashbrown:: hash_table :: Entry :: Occupied ( _) => unreachable ! ( ) ,
177
+ hashbrown:: hash_table :: Entry :: Vacant ( entry) => {
178
+ entry. insert ( idx) ;
179
179
}
180
180
}
181
181
}
@@ -196,8 +196,8 @@ impl AstIdMap {
196
196
pub fn ast_id_for_ptr < N : AstIdNode > ( & self , ptr : AstPtr < N > ) -> FileAstId < N > {
197
197
let ptr = ptr. syntax_node_ptr ( ) ;
198
198
let hash = hash_ptr ( & ptr) ;
199
- match self . map . raw_entry ( ) . from_hash ( hash, |& idx| self . arena [ idx] == ptr) {
200
- Some ( ( & raw, & ( ) ) ) => FileAstId {
199
+ match self . map . find ( hash, |& idx| self . arena [ idx] == ptr) {
200
+ Some ( & raw) => FileAstId {
201
201
raw : ErasedFileAstId ( raw. into_raw ( ) . into_u32 ( ) ) ,
202
202
covariant : PhantomData ,
203
203
} ,
@@ -221,8 +221,8 @@ impl AstIdMap {
221
221
fn erased_ast_id ( & self , item : & SyntaxNode ) -> ErasedFileAstId {
222
222
let ptr = SyntaxNodePtr :: new ( item) ;
223
223
let hash = hash_ptr ( & ptr) ;
224
- match self . map . raw_entry ( ) . from_hash ( hash, |& idx| self . arena [ idx] == ptr) {
225
- Some ( ( & idx, & ( ) ) ) => ErasedFileAstId ( idx. into_raw ( ) . into_u32 ( ) ) ,
224
+ match self . map . find ( hash, |& idx| self . arena [ idx] == ptr) {
225
+ Some ( & idx) => ErasedFileAstId ( idx. into_raw ( ) . into_u32 ( ) ) ,
226
226
None => panic ! (
227
227
"Can't find {:?} in AstIdMap:\n {:?}\n source text: {}" ,
228
228
item,
0 commit comments