@@ -4,7 +4,7 @@ use std::cell::Cell;
4
4
use std:: mem;
5
5
6
6
use rustc_ast:: NodeId ;
7
- use rustc_data_structures:: fx:: FxHashSet ;
7
+ use rustc_data_structures:: fx:: { FxHashSet , FxIndexSet } ;
8
8
use rustc_data_structures:: intern:: Interned ;
9
9
use rustc_errors:: codes:: * ;
10
10
use rustc_errors:: { Applicability , MultiSpan , pluralize, struct_span_code_err} ;
@@ -233,7 +233,7 @@ impl<'ra> ImportData<'ra> {
233
233
pub ( crate ) struct NameResolution < ' ra > {
234
234
/// Single imports that may define the name in the namespace.
235
235
/// Imports are arena-allocated, so it's ok to use pointers as keys.
236
- pub single_imports : FxHashSet < Import < ' ra > > ,
236
+ pub single_imports : FxIndexSet < Import < ' ra > > ,
237
237
/// The least shadowable known binding for this name, or None if there are no known bindings.
238
238
pub binding : Option < NameBinding < ' ra > > ,
239
239
pub shadowed_glob : Option < NameBinding < ' ra > > ,
@@ -494,7 +494,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
494
494
let key = BindingKey :: new ( target, ns) ;
495
495
let _ = this. try_define ( import. parent_scope . module , key, dummy_binding, false ) ;
496
496
this. update_resolution ( import. parent_scope . module , key, false , |_, resolution| {
497
- resolution. single_imports . remove ( & import) ;
497
+ resolution. single_imports . swap_remove ( & import) ;
498
498
} )
499
499
} ) ;
500
500
self . record_use ( target, dummy_binding, Used :: Other ) ;
@@ -862,7 +862,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
862
862
}
863
863
let key = BindingKey :: new ( target, ns) ;
864
864
this. update_resolution ( parent, key, false , |_, resolution| {
865
- resolution. single_imports . remove ( & import) ;
865
+ resolution. single_imports . swap_remove ( & import) ;
866
866
} ) ;
867
867
}
868
868
}
0 commit comments