@@ -1575,8 +1575,12 @@ private predicate unqualifiedPathLookup(ItemNode ancestor, string name, Namespac
15751575 not (
15761576 name = "Self" and
15771577 mid = any ( ImplOrTraitItemNode i ) .getAnItemInSelfScope ( )
1578- ) and
1578+ )
1579+ |
15791580 ancestor = getOuterScope ( mid )
1581+ or
1582+ ns .isMacro ( ) and
1583+ ancestor = mid .getImmediateParentModule ( )
15801584 )
15811585}
15821586
@@ -1680,16 +1684,17 @@ private predicate expandsMacro(AstNode macroInvocation, AstNode expansion, Path
16801684}
16811685
16821686pragma [ nomagic]
1683- predicate isInMacroFromCrateExpansion ( CrateItemNode crate , AstNode n ) {
1684- exists ( Path path |
1685- expandsMacro ( _, n , path ) and
1686- crate .getASourceFile ( ) .getFile ( ) = resolvePathCand ( path ) .getFile ( )
1687- )
1687+ predicate isInMacroExpansion ( Path macroDefPath , AstNode macroInvocation , AstNode n ) {
1688+ expandsMacro ( macroInvocation , n , macroDefPath )
16881689 or
1689- exists ( AstNode mid |
1690- isInMacroFromCrateExpansion ( crate , mid ) and
1691- n .getParentNode ( ) = mid and
1692- not expandsMacro ( mid , n , _)
1690+ isInMacroExpansion ( macroDefPath , macroInvocation , n .getParentNode ( ) )
1691+ }
1692+
1693+ pragma [ nomagic]
1694+ predicate isInMacroFromCrateExpansion ( CrateItemNode crate , AstNode macroInvocation , AstNode n ) {
1695+ exists ( Path macroDefPath |
1696+ isInMacroExpansion ( macroDefPath , macroInvocation , n ) and
1697+ crate .getASourceFile ( ) .getFile ( ) = resolvePathCand ( macroDefPath ) .getFile ( )
16931698 )
16941699}
16951700
@@ -1706,7 +1711,7 @@ private ItemNode resolvePathCand0(RelevantPath path, Namespace ns) {
17061711 )
17071712 or
17081713 path .isDollarCrate ( ) and
1709- isInMacroFromCrateExpansion ( result , path ) and
1714+ isInMacroFromCrateExpansion ( result , _ , path ) and
17101715 ns = result .getNamespace ( )
17111716 or
17121717 result = resolvePathCandQualified ( _, _, path , ns )
0 commit comments