File tree 1 file changed +16
-18
lines changed
compiler/rustc_resolve/src
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> {
1472
1472
false ,
1473
1473
unusable_binding,
1474
1474
)
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
+ {
1487
1478
match this. resolve_ident_in_lexical_scope (
1488
1479
ident,
1489
1480
ns,
1490
1481
parent_scope,
1491
1482
finalize_full,
1492
- & ribs. unwrap ( ) [ ns] ,
1483
+ & ribs[ ns] ,
1493
1484
unusable_binding,
1494
1485
) {
1495
1486
// we found a locally-imported or available item/module
1496
1487
Some ( LexicalScopeBinding :: Item ( binding) ) => Ok ( binding) ,
1497
1488
// 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) ,
1503
1490
_ => Err ( Determinacy :: determined ( finalize. is_some ( ) ) ) ,
1504
1491
}
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
+ )
1505
1503
} ;
1506
1504
FindBindingResult :: Binding ( binding)
1507
1505
} ;
You can’t perform that action at this time.
0 commit comments