@@ -4,7 +4,7 @@ use std::cell::Cell;
44use std:: mem;
55
66use rustc_ast:: NodeId ;
7- use rustc_data_structures:: fx:: FxHashSet ;
7+ use rustc_data_structures:: fx:: { FxHashSet , FxIndexSet } ;
88use rustc_data_structures:: intern:: Interned ;
99use rustc_errors:: codes:: * ;
1010use rustc_errors:: { Applicability , MultiSpan , pluralize, struct_span_code_err} ;
@@ -233,7 +233,7 @@ impl<'ra> ImportData<'ra> {
233233pub ( crate ) struct NameResolution < ' ra > {
234234 /// Single imports that may define the name in the namespace.
235235 /// 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 > > ,
237237 /// The least shadowable known binding for this name, or None if there are no known bindings.
238238 pub binding : Option < NameBinding < ' ra > > ,
239239 pub shadowed_glob : Option < NameBinding < ' ra > > ,
@@ -494,7 +494,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
494494 let key = BindingKey :: new ( target, ns) ;
495495 let _ = this. try_define ( import. parent_scope . module , key, dummy_binding, false ) ;
496496 this. update_resolution ( import. parent_scope . module , key, false , |_, resolution| {
497- resolution. single_imports . remove ( & import) ;
497+ resolution. single_imports . swap_remove ( & import) ;
498498 } )
499499 } ) ;
500500 self . record_use ( target, dummy_binding, Used :: Other ) ;
@@ -862,7 +862,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
862862 }
863863 let key = BindingKey :: new ( target, ns) ;
864864 this. update_resolution ( parent, key, false , |_, resolution| {
865- resolution. single_imports . remove ( & import) ;
865+ resolution. single_imports . swap_remove ( & import) ;
866866 } ) ;
867867 }
868868 }
0 commit comments