@@ -902,27 +902,24 @@ impl<'a> Resolver<'a> {
902
902
self . resolution ( module, key) . try_borrow_mut ( ) . map_err ( |_| ( Determined , Weak :: No ) ) ?; // This happens when there is a cycle of imports.
903
903
904
904
if let Some ( path_span) = finalize {
905
- let Some ( mut binding) = resolution. binding else {
906
- return Err ( ( Determined , Weak :: No ) ) ;
907
- } ;
908
-
909
905
// If the primary binding is unusable, search further and return the shadowed glob
910
906
// binding if it exists. What we really want here is having two separate scopes in
911
907
// a module - one for non-globs and one for globs, but until that's done use this
912
908
// hack to avoid inconsistent resolution ICEs during import validation.
913
- if let Some ( unusable_binding) = unusable_binding
914
- && ptr:: eq ( binding, unusable_binding)
915
- {
916
- let Some ( shadowed) = resolution. shadowed_glob else {
917
- return Err ( ( Determined , Weak :: No ) ) ;
918
- } ;
919
-
920
- if ptr:: eq ( shadowed, unusable_binding) {
921
- return Err ( ( Determined , Weak :: No ) ) ;
922
- }
923
-
924
- binding = shadowed;
925
- }
909
+ let binding = [ resolution. binding , resolution. shadowed_glob ]
910
+ . into_iter ( )
911
+ . filter_map ( |binding| match ( binding, unusable_binding) {
912
+ ( Some ( binding) , Some ( unusable_binding) )
913
+ if ptr:: eq ( binding, unusable_binding) =>
914
+ {
915
+ None
916
+ }
917
+ _ => binding,
918
+ } )
919
+ . next ( ) ;
920
+ let Some ( binding) = binding else {
921
+ return Err ( ( Determined , Weak :: No ) ) ;
922
+ } ;
926
923
927
924
if !self . is_accessible_from ( binding. vis , parent_scope. module ) {
928
925
if last_import_segment {
0 commit comments