File tree Expand file tree Collapse file tree 1 file changed +16
-18
lines changed
compiler/rustc_resolve/src Expand file tree Collapse file tree 1 file changed +16
-18
lines changed Original file line number Diff line number Diff line change @@ -1472,36 +1472,34 @@ impl<'a> Resolver<'a> {
14721472 false ,
14731473 unusable_binding,
14741474 )
1475- } else if ribs. is_none ( ) || opt_ns. is_none ( ) || opt_ns == Some ( MacroNS ) {
1476- let scopes = ScopeSet :: All ( ns, opt_ns. is_none ( ) ) ;
1477- this. early_resolve_ident_in_lexical_scope (
1478- ident,
1479- scopes,
1480- parent_scope,
1481- finalize,
1482- finalize. is_some ( ) ,
1483- false ,
1484- unusable_binding,
1485- )
1486- } else {
1475+ } else if let Some ( ribs) = ribs
1476+ && let Some ( TypeNS | ValueNS ) = opt_ns
1477+ {
14871478 match this. resolve_ident_in_lexical_scope (
14881479 ident,
14891480 ns,
14901481 parent_scope,
14911482 finalize_full,
1492- & ribs. unwrap ( ) [ ns] ,
1483+ & ribs[ ns] ,
14931484 unusable_binding,
14941485 ) {
14951486 // we found a locally-imported or available item/module
14961487 Some ( LexicalScopeBinding :: Item ( binding) ) => Ok ( binding) ,
14971488 // we found a local variable or type param
1498- Some ( LexicalScopeBinding :: Res ( res) )
1499- if opt_ns == Some ( TypeNS ) || opt_ns == Some ( ValueNS ) =>
1500- {
1501- return FindBindingResult :: Res ( res) ;
1502- }
1489+ Some ( LexicalScopeBinding :: Res ( res) ) => return FindBindingResult :: Res ( res) ,
15031490 _ => Err ( Determinacy :: determined ( finalize. is_some ( ) ) ) ,
15041491 }
1492+ } else {
1493+ let scopes = ScopeSet :: All ( ns, opt_ns. is_none ( ) ) ;
1494+ this. early_resolve_ident_in_lexical_scope (
1495+ ident,
1496+ scopes,
1497+ parent_scope,
1498+ finalize,
1499+ finalize. is_some ( ) ,
1500+ false ,
1501+ unusable_binding,
1502+ )
15051503 } ;
15061504 FindBindingResult :: Binding ( binding)
15071505 } ;
You can’t perform that action at this time.
0 commit comments