@@ -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) = {
@@ -526,7 +526,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
526526 // Don't remove underscores from `single_imports`, they were never added.
527527 if target. name != kw:: Underscore {
528528 let key = BindingKey :: new ( target, ns) ;
529- this. update_resolution ( module, key, false , |_, resolution| {
529+ this. update_local_resolution ( module, key, false , |_, resolution| {
530530 resolution. single_imports . swap_remove ( & import) ;
531531 } )
532532 }
@@ -909,7 +909,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
909909 // Don't remove underscores from `single_imports`, they were never added.
910910 if target. name != kw:: Underscore {
911911 let key = BindingKey :: new ( target, ns) ;
912- this. update_resolution ( parent, key, false , |_, resolution| {
912+ this. update_local_resolution ( parent, key, false , |_, resolution| {
913913 resolution. single_imports . swap_remove ( & import) ;
914914 } ) ;
915915 }
0 commit comments