Skip to content

Commit b64809c

Browse files
committed
Rust: Adapt QL to AST changes
1 parent dd02ac3 commit b64809c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

rust/ql/lib/codeql/rust/elements/internal/ElementImpl.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ module Impl {
4646
private predicate isMacroExpansion(AstNode macro, AstNode expansion) {
4747
expansion = macro.(MacroCall).getMacroCallExpansion()
4848
or
49-
expansion = macro.(Adt).getDeriveMacroExpansion(_)
49+
expansion = macro.(TypeItem).getDeriveMacroExpansion(_)
5050
or
5151
expansion = macro.(Item).getAttributeMacroExpansion()
5252
}

rust/ql/lib/codeql/rust/internal/PathResolution.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,9 +1796,9 @@ private module DollarCrateResolution {
17961796
macroDefPath = mc.getPath()
17971797
)
17981798
or
1799-
exists(ItemNode adt |
1800-
expansion = adt.(Adt).getDeriveMacroExpansion(_) and
1801-
macroDefPath = adt.getAttr("derive").getMeta().getPath()
1799+
exists(ItemNode type |
1800+
expansion = type.(TypeItem).getDeriveMacroExpansion(_) and
1801+
macroDefPath = type.getAttr("derive").getMeta().getPath()
18021802
)
18031803
}
18041804

rust/ql/test/extractor-tests/macro-expansion/test.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ query predicate attribute_macros(Item i, int index, Item expanded) {
55
i.fromSource() and expanded = i.getAttributeMacroExpansion().getItem(index)
66
}
77

8-
query predicate derive_macros(Adt i, int index, int subIndex, Item expanded) {
8+
query predicate derive_macros(TypeItem i, int index, int subIndex, Item expanded) {
99
i.fromSource() and expanded = i.getDeriveMacroExpansion(index).getItem(subIndex)
1010
}
1111

0 commit comments

Comments
 (0)