@@ -618,7 +618,7 @@ enum AmbiguityKind {
618618 Import ,
619619 BuiltinAttr ,
620620 DeriveHelper ,
621- LegacyVsModern ,
621+ MacroRulesVsModularized ,
622622 GlobVsOuter ,
623623 GlobVsGlob ,
624624 GlobVsExpanded ,
@@ -631,7 +631,9 @@ impl AmbiguityKind {
631631 AmbiguityKind :: Import => "name vs any other name during import resolution" ,
632632 AmbiguityKind :: BuiltinAttr => "built-in attribute vs any other name" ,
633633 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+ }
635637 AmbiguityKind :: GlobVsOuter => {
636638 "glob import vs any other name from outer scope during import/macro resolution"
637639 }
@@ -1473,7 +1475,7 @@ impl<'a> Resolver<'a> {
14731475 // derives (you need to resolve the derive first to add helpers into scope), but they
14741476 // should be available before the derive is expanded for compatibility.
14751477 // 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
14771479 // priority than prelude macros, but create ambiguities with macros in modules.
14781480 // 1-3. Names in modules (both normal `mod`ules and blocks), loop through hygienic parents
14791481 // (open, not controlled). Have higher priority than prelude macros, but create
@@ -1639,7 +1641,7 @@ impl<'a> Resolver<'a> {
16391641 for i in ( 0 ..ribs. len ( ) ) . rev ( ) {
16401642 debug ! ( "walk rib\n {:?}" , ribs[ i] . bindings) ;
16411643 // 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).
16431645 let rib_ident = if ribs[ i] . kind . contains_params ( ) { modern_ident } else { ident } ;
16441646 if let Some ( res) = ribs[ i] . bindings . get ( & rib_ident) . cloned ( ) {
16451647 // The ident resolves to a type parameter or local variable.
@@ -1898,7 +1900,7 @@ impl<'a> Resolver<'a> {
18981900 break ;
18991901 }
19001902 }
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.
19021904 for ( mark, transparency) in iter {
19031905 if transparency == Transparency :: SemiTransparent {
19041906 result = Some ( mark) ;
@@ -2423,21 +2425,21 @@ impl<'a> Resolver<'a> {
24232425 }
24242426 }
24252427
2426- fn disambiguate_legacy_vs_modern (
2428+ fn disambiguate_macro_rules_vs_modularized (
24272429 & self ,
2428- legacy : & ' a NameBinding < ' a > ,
2429- modern : & ' a NameBinding < ' a > ,
2430+ macro_rules : & ' a NameBinding < ' a > ,
2431+ modularized : & ' a NameBinding < ' a > ,
24302432 ) -> bool {
24312433 // Some non-controversial subset of ambiguities "modern macro name" vs "macro_rules"
24322434 // is disambiguated to mitigate regressions from macro modularization.
24332435 // Scoping for `macro_rules` behaves like scoping for `let` at module level, in general.
24342436 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 ) ) ,
24372439 ) {
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 )
24412443 }
24422444 _ => false ,
24432445 }
0 commit comments