@@ -78,6 +78,24 @@ private ItemNode getAChildSuccessor(ItemNode item, string name, SuccessorKind ki
7878 )
7979}
8080
81+ /**
82+ * Holds if `n` is superceded by an attribute macro expansion. That is, `n` is
83+ * an item or a transitive child of an item with an attribute macro expansion.
84+ */
85+ predicate supercededByAttributeMacroExpansion ( AstNode n ) {
86+ n .( Item ) .hasAttributeMacroExpansion ( )
87+ or
88+ exists ( AstNode parent |
89+ n .getParentNode ( ) = parent and
90+ supercededByAttributeMacroExpansion ( parent ) and
91+ // Don't exclude expansions themselves as they supercede other nodes.
92+ not n = parent .( Item ) .getAttributeMacroExpansion ( ) and
93+ // Don't consider attributes themselves to be superceded. E.g., in `#[a] fn
94+ // f() {}` the macro expansion supercedes `fn f() {}` but not `#[a]`.
95+ not n instanceof Attr
96+ )
97+ }
98+
8199/**
82100 * An item that may be referred to by a path, and which is a node in
83101 * the _item graph_.
@@ -158,7 +176,7 @@ private ItemNode getAChildSuccessor(ItemNode item, string name, SuccessorKind ki
158176abstract class ItemNode extends Locatable {
159177 ItemNode ( ) {
160178 // Exclude items that are superceded by the expansion of an attribute macro.
161- not this . ( Item ) . hasAttributeMacroExpansion ( )
179+ not supercededByAttributeMacroExpansion ( this )
162180 }
163181
164182 /** Gets the (original) name of this item. */
@@ -1760,8 +1778,10 @@ private module Debug {
17601778 private Locatable getRelevantLocatable ( ) {
17611779 exists ( string filepath , int startline , int startcolumn , int endline , int endcolumn |
17621780 result .getLocation ( ) .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn ) and
1763- filepath .matches ( "%/module_info.rs" ) and
1764- startline = [ 131 .. 157 ]
1781+ filepath .matches ( "%/main.rs" ) and
1782+ startline = [ 764 .. 781 ]
1783+ // filepath.matches("%/module_info.rs") and
1784+ // startline = [131 .. 157]
17651785 )
17661786 }
17671787
0 commit comments