@@ -456,13 +456,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
456456 warn_ambiguity,
457457 |this, resolution| {
458458 assert ! ( !decl. warn_ambiguity. get( ) ) ;
459- if res == Res :: Err
460- && let Some ( old_decl) = resolution. best_decl ( )
461- && old_decl. res ( ) != Res :: Err
462- {
463- // Do not override real declarations with `Res::Err`s from error recovery.
464- return Ok ( ( ) ) ;
465- }
466459 if decl. is_glob_import ( ) {
467460 resolution. glob_decl = Some ( match resolution. glob_decl {
468461 Some ( old_decl) => this. select_glob_decl (
@@ -533,13 +526,14 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
533526 } ;
534527 if self . is_accessible_from ( binding. vis ( ) , scope) {
535528 let import_decl = self . new_import_decl ( binding, * import) ;
536- let _ = self . try_plant_decl_into_local_module (
529+ self . try_plant_decl_into_local_module (
537530 ident,
538531 orig_ident_span,
539532 key. ns ,
540533 import_decl,
541534 warn_ambiguity,
542- ) ;
535+ )
536+ . expect ( "planting a glob cannot fail" ) ;
543537 }
544538 }
545539
@@ -558,6 +552,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
558552 self . per_ns ( |this, ns| {
559553 let module = import. parent_scope . module ;
560554 let ident = IdentKey :: new ( target) ;
555+ // This can fail, dummies are inserted only in non-occupied slots.
561556 let _ = this. try_plant_decl_into_local_module (
562557 ident,
563558 target. span ,
@@ -1613,13 +1608,14 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
16131608 . resolution ( import. parent_scope . module , key)
16141609 . and_then ( |r| r. determined_decl ( ) )
16151610 . is_some_and ( |binding| binding. warn_ambiguity_recursive ( ) ) ;
1616- let _ = self . try_plant_decl_into_local_module (
1611+ self . try_plant_decl_into_local_module (
16171612 key. ident ,
16181613 orig_ident_span,
16191614 key. ns ,
16201615 import_decl,
16211616 warn_ambiguity,
1622- ) ;
1617+ )
1618+ . expect ( "planting a glob cannot fail" ) ;
16231619 }
16241620 }
16251621
0 commit comments