@@ -334,7 +334,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
334334 }
335335
336336 /// Define the name or return the existing binding if there is a collision.
337- /// `update` indicates if the definition is a redefinition of an existing binding.
338337 pub ( crate ) fn try_define_local (
339338 & mut self ,
340339 module : Module < ' ra > ,
@@ -352,7 +351,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
352351 let key = BindingKey :: new_disambiguated ( ident, ns, || {
353352 ( module. 0 . 0 . lazy_resolutions . borrow ( ) . len ( ) + 1 ) . try_into ( ) . unwrap ( )
354353 } ) ;
355- self . update_resolution ( module, key, warn_ambiguity, |this, resolution| {
354+ self . update_local_resolution ( module, key, warn_ambiguity, |this, resolution| {
356355 if let Some ( old_binding) = resolution. best_binding ( ) {
357356 if res == Res :: Err && old_binding. res ( ) != Res :: Err {
358357 // Do not override real bindings with `Res::Err`s from error recovery.
@@ -455,7 +454,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
455454
456455 // Use `f` to mutate the resolution of the name in the module.
457456 // If the resolution becomes a success, define it in the module's glob importers.
458- fn update_resolution < T , F > (
457+ fn update_local_resolution < T , F > (
459458 & mut self ,
460459 module : Module < ' ra > ,
461460 key : BindingKey ,
@@ -465,6 +464,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
465464 where
466465 F : FnOnce ( & Resolver < ' ra , ' tcx > , & mut NameResolution < ' ra > ) -> T ,
467466 {
467+ assert ! ( module. is_local( ) ) ;
468468 // Ensure that `resolution` isn't borrowed when defining in the module's glob importers,
469469 // during which the resolution might end up getting re-defined via a glob cycle.
470470 let ( binding, t, warn_ambiguity) = {
@@ -532,7 +532,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
532532 // Don't remove underscores from `single_imports`, they were never added.
533533 if target. name != kw:: Underscore {
534534 let key = BindingKey :: new ( target, ns) ;
535- this. update_resolution ( module, key, false , |_, resolution| {
535+ this. update_local_resolution ( module, key, false , |_, resolution| {
536536 resolution. single_imports . swap_remove ( & import) ;
537537 } )
538538 }
@@ -915,7 +915,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
915915 // Don't remove underscores from `single_imports`, they were never added.
916916 if target. name != kw:: Underscore {
917917 let key = BindingKey :: new ( target, ns) ;
918- this. update_resolution ( parent, key, false , |_, resolution| {
918+ this. update_local_resolution ( parent, key, false , |_, resolution| {
919919 resolution. single_imports . swap_remove ( & import) ;
920920 } ) ;
921921 }
0 commit comments