@@ -82,32 +82,40 @@ impl<'ra> ImportResolutionOutputs<'ra> {
8282 ImportKind :: Single { target, bindings, .. } ,
8383 SideEffectBindings :: Single { import_bindings } ,
8484 ) => {
85- for ( ns , pending_binding ) in import_bindings . into_iter_with ( ) {
86- match pending_binding {
85+ r . per_ns ( |this , ns| {
86+ match import_bindings [ ns ] {
8787 PendingBinding :: Ready ( Some ( binding) ) => {
8888 if binding. is_assoc_item ( )
89- && !r . tcx . features ( ) . import_trait_associated_functions ( )
89+ && !this . tcx . features ( ) . import_trait_associated_functions ( )
9090 {
9191 feature_err (
92- r . tcx . sess ,
92+ this . tcx . sess ,
9393 sym:: import_trait_associated_functions,
9494 import. span ,
9595 "`use` associated items of traits is unstable" ,
9696 )
9797 . emit ( ) ;
9898 }
99- r . define_binding_local ( parent, * target, ns, binding) ;
99+ this . define_binding_local ( parent, * target, ns, binding) ;
100100 }
101101 PendingBinding :: Ready ( None ) => {
102- let key = BindingKey :: new ( * target, ns) ;
103- r. update_local_resolution ( parent, key, false , |_, resolution| {
104- resolution. single_imports . swap_remove ( & import) ;
105- } ) ;
102+ // Don't remove underscores from `single_imports`, they were never added.
103+ if target. name != kw:: Underscore {
104+ let key = BindingKey :: new ( * target, ns) ;
105+ this. update_local_resolution (
106+ parent,
107+ key,
108+ false ,
109+ |_, resolution| {
110+ resolution. single_imports . swap_remove ( & import) ;
111+ } ,
112+ ) ;
113+ }
106114 }
107115 _ => { }
108116 }
109- bindings[ ns] . set ( pending_binding ) ;
110- }
117+ bindings[ ns] . set ( import_bindings [ ns ] ) ;
118+ } ) ;
111119 }
112120 ( ImportKind :: Glob { id, .. } , SideEffectBindings :: Glob { import_bindings } ) => {
113121 let ModuleOrUniformRoot :: Module ( module) = import. imported_module . get ( ) . unwrap ( )
@@ -973,7 +981,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
973981 }
974982 } ;
975983
976- let ( source, target , bindings, type_ns_only) = match import. kind {
984+ let ( source, _ , bindings, type_ns_only) = match import. kind {
977985 ImportKind :: Single { source, target, ref bindings, type_ns_only, .. } => {
978986 ( source, target, bindings, type_ns_only)
979987 }
@@ -989,7 +997,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
989997 _ => unreachable ! ( ) ,
990998 } ;
991999
992- let mut import_bindings = PerNS :: default ( ) ;
1000+ let mut import_bindings = bindings . clone ( ) . map ( |b| b . get ( ) ) ;
9931001 let mut indeterminate_count = 0 ;
9941002 self . reborrow ( ) . per_ns_cm ( |this, ns| {
9951003 if !type_ns_only || ns == TypeNS {
@@ -1009,16 +1017,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
10091017 let imported_binding = this. import ( binding, import) ;
10101018 PendingBinding :: Ready ( Some ( imported_binding) )
10111019 }
1012- Err ( Determinacy :: Determined ) => {
1013- // Don't remove underscores from `single_imports`, they were never added.
1014- if target. name == kw:: Underscore {
1015- return ;
1016- }
1017- PendingBinding :: Ready ( None )
1018- }
1020+ Err ( Determinacy :: Determined ) => PendingBinding :: Ready ( None ) ,
10191021 Err ( Determinacy :: Undetermined ) => {
10201022 indeterminate_count += 1 ;
1021- return ;
1023+ PendingBinding :: Pending
10221024 }
10231025 } ;
10241026 import_bindings[ ns] = pending_binding;
0 commit comments