diff --git a/rust/ql/lib/codeql/rust/elements/internal/ElementImpl.qll b/rust/ql/lib/codeql/rust/elements/internal/ElementImpl.qll index 158a5ee9670..df586df6424 100644 --- a/rust/ql/lib/codeql/rust/elements/internal/ElementImpl.qll +++ b/rust/ql/lib/codeql/rust/elements/internal/ElementImpl.qll @@ -46,7 +46,7 @@ module Impl { private predicate isMacroExpansion(AstNode macro, AstNode expansion) { expansion = macro.(MacroCall).getMacroCallExpansion() or - expansion = macro.(Adt).getDeriveMacroExpansion(_) + expansion = macro.(TypeItem).getDeriveMacroExpansion(_) or expansion = macro.(Item).getAttributeMacroExpansion() } diff --git a/rust/ql/lib/codeql/rust/internal/PathResolution.qll b/rust/ql/lib/codeql/rust/internal/PathResolution.qll index 28a72d370ae..c969e62a357 100644 --- a/rust/ql/lib/codeql/rust/internal/PathResolution.qll +++ b/rust/ql/lib/codeql/rust/internal/PathResolution.qll @@ -1796,9 +1796,9 @@ private module DollarCrateResolution { macroDefPath = mc.getPath() ) or - exists(ItemNode adt | - expansion = adt.(Adt).getDeriveMacroExpansion(_) and - macroDefPath = adt.getAttr("derive").getMeta().getPath() + exists(ItemNode type | + expansion = type.(TypeItem).getDeriveMacroExpansion(_) and + macroDefPath = type.getAttr("derive").getMeta().getPath() ) } diff --git a/rust/ql/test/extractor-tests/macro-expansion/test.ql b/rust/ql/test/extractor-tests/macro-expansion/test.ql index 7d97ea6a10f..6372dc2e93f 100644 --- a/rust/ql/test/extractor-tests/macro-expansion/test.ql +++ b/rust/ql/test/extractor-tests/macro-expansion/test.ql @@ -5,7 +5,7 @@ query predicate attribute_macros(Item i, int index, Item expanded) { i.fromSource() and expanded = i.getAttributeMacroExpansion().getItem(index) } -query predicate derive_macros(Adt i, int index, int subIndex, Item expanded) { +query predicate derive_macros(TypeItem i, int index, int subIndex, Item expanded) { i.fromSource() and expanded = i.getDeriveMacroExpansion(index).getItem(subIndex) }