@@ -618,7 +618,7 @@ enum AmbiguityKind {
618
618
Import ,
619
619
BuiltinAttr ,
620
620
DeriveHelper ,
621
- LegacyVsModern ,
621
+ MacroRulesVsModularized ,
622
622
GlobVsOuter ,
623
623
GlobVsGlob ,
624
624
GlobVsExpanded ,
@@ -631,7 +631,9 @@ impl AmbiguityKind {
631
631
AmbiguityKind :: Import => "name vs any other name during import resolution" ,
632
632
AmbiguityKind :: BuiltinAttr => "built-in attribute vs any other name" ,
633
633
AmbiguityKind :: DeriveHelper => "derive helper attribute vs any other name" ,
634
- AmbiguityKind :: LegacyVsModern => "`macro_rules` vs non-`macro_rules` from other module" ,
634
+ AmbiguityKind :: MacroRulesVsModularized => {
635
+ "`macro_rules` vs non-`macro_rules` from other module"
636
+ }
635
637
AmbiguityKind :: GlobVsOuter => {
636
638
"glob import vs any other name from outer scope during import/macro resolution"
637
639
}
@@ -1473,7 +1475,7 @@ impl<'a> Resolver<'a> {
1473
1475
// derives (you need to resolve the derive first to add helpers into scope), but they
1474
1476
// should be available before the derive is expanded for compatibility.
1475
1477
// It's mess in general, so we are being conservative for now.
1476
- // 1-3. `macro_rules` (open, not controlled), loop through legacy scopes. Have higher
1478
+ // 1-3. `macro_rules` (open, not controlled), loop through `macro_rules` scopes. Have higher
1477
1479
// priority than prelude macros, but create ambiguities with macros in modules.
1478
1480
// 1-3. Names in modules (both normal `mod`ules and blocks), loop through hygienic parents
1479
1481
// (open, not controlled). Have higher priority than prelude macros, but create
@@ -1639,7 +1641,7 @@ impl<'a> Resolver<'a> {
1639
1641
for i in ( 0 ..ribs. len ( ) ) . rev ( ) {
1640
1642
debug ! ( "walk rib\n {:?}" , ribs[ i] . bindings) ;
1641
1643
// Use the rib kind to determine whether we are resolving parameters
1642
- // (modern hygiene) or local variables (legacy hygiene).
1644
+ // (modern hygiene) or local variables (`macro_rules` hygiene).
1643
1645
let rib_ident = if ribs[ i] . kind . contains_params ( ) { modern_ident } else { ident } ;
1644
1646
if let Some ( res) = ribs[ i] . bindings . get ( & rib_ident) . cloned ( ) {
1645
1647
// The ident resolves to a type parameter or local variable.
@@ -1898,7 +1900,7 @@ impl<'a> Resolver<'a> {
1898
1900
break ;
1899
1901
}
1900
1902
}
1901
- // Then find the last legacy mark from the end if it exists.
1903
+ // Then find the last semi-transparent mark from the end if it exists.
1902
1904
for ( mark, transparency) in iter {
1903
1905
if transparency == Transparency :: SemiTransparent {
1904
1906
result = Some ( mark) ;
@@ -2423,21 +2425,21 @@ impl<'a> Resolver<'a> {
2423
2425
}
2424
2426
}
2425
2427
2426
- fn disambiguate_legacy_vs_modern (
2428
+ fn disambiguate_macro_rules_vs_modularized (
2427
2429
& self ,
2428
- legacy : & ' a NameBinding < ' a > ,
2429
- modern : & ' a NameBinding < ' a > ,
2430
+ macro_rules : & ' a NameBinding < ' a > ,
2431
+ modularized : & ' a NameBinding < ' a > ,
2430
2432
) -> bool {
2431
2433
// Some non-controversial subset of ambiguities "modern macro name" vs "macro_rules"
2432
2434
// is disambiguated to mitigate regressions from macro modularization.
2433
2435
// Scoping for `macro_rules` behaves like scoping for `let` at module level, in general.
2434
2436
match (
2435
- self . binding_parent_modules . get ( & PtrKey ( legacy ) ) ,
2436
- self . binding_parent_modules . get ( & PtrKey ( modern ) ) ,
2437
+ self . binding_parent_modules . get ( & PtrKey ( macro_rules ) ) ,
2438
+ self . binding_parent_modules . get ( & PtrKey ( modularized ) ) ,
2437
2439
) {
2438
- ( Some ( legacy ) , Some ( modern ) ) => {
2439
- legacy . normal_ancestor_id == modern . normal_ancestor_id
2440
- && modern . is_ancestor_of ( legacy )
2440
+ ( Some ( macro_rules ) , Some ( modularized ) ) => {
2441
+ macro_rules . normal_ancestor_id == modularized . normal_ancestor_id
2442
+ && modularized . is_ancestor_of ( macro_rules )
2441
2443
}
2442
2444
_ => false ,
2443
2445
}
0 commit comments