Skip to content

Commit eff3fd3

Browse files
committed
Rust: add warning to macro expansion integration test
1 parent 41d9ca1 commit eff3fd3

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

rust/ql/integration-tests/macro-expansion/test.expected

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,7 @@ unexpanded_macro_calls
3737
| calls/src/included.rs:2:9:2:39 | concat!... |
3838
| calls/src/lib.rs:22:9:22:31 | concat!... |
3939
| calls/src/lib.rs:29:9:29:32 | include_str!... |
40+
warnings
41+
| calls/src/included.rs:2:9:2:39 | macro expansion failed: could not resolve macro 'concat' |
42+
| calls/src/lib.rs:22:9:22:31 | macro expansion failed: could not resolve macro 'concat' |
43+
| calls/src/lib.rs:29:9:29:32 | macro expansion failed: could not resolve macro 'include_str' |

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import rust
2+
import codeql.rust.Diagnostics
23

34
query predicate attribute_macros(Item i, int index, Item expanded) {
45
i.fromSource() and expanded = i.getAttributeMacroExpansion().getItem(index)
@@ -13,3 +14,5 @@ query predicate macro_calls(MacroCall c, AstNode expansion) {
1314
query predicate unexpanded_macro_calls(MacroCall c) {
1415
c.fromSource() and not c.hasMacroCallExpansion()
1516
}
17+
18+
query predicate warnings(ExtractionWarning w) { w.getLocation().fromSource() }

0 commit comments

Comments
 (0)