Skip to content

Commit 80031e5

Browse files
authored
Merge pull request #20273 from hvitved/rust/attribute-in-macro-expansion
Rust: Include `getAttributeMacroExpansion` in `isInMacroExpansion`
2 parents fb7c3f3 + 9b4d37d commit 80031e5

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* Attribute macros are now taken into account when identifying macro-expanded code. This affects the queries `rust/unused-variable` and `rust/unused-value`, which exclude results in macro-expanded code.

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ module Impl {
1919
or
2020
n = root.(Adt).getDeriveMacroExpansion(_)
2121
or
22+
n = root.(Item).getAttributeMacroExpansion()
23+
or
2224
isInMacroExpansion(root, n.getParentNode())
2325
}
2426

0 commit comments

Comments
 (0)