Skip to content

Commit 7b39608

Browse files
authored
Merge pull request github#17589 from geoffw0/missing2
Rust: Repair rust/diagnostics/unextracted-elements
2 parents 76914c4 + bc83106 commit 7b39608

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* @name Unextracted Elements
3+
* @description List all elements that weren't extracted due to unimplemented features or parse errors.
4+
* @id rust/diagnostics/unextracted-elements
5+
*/
6+
7+
import rust
8+
9+
/**
10+
* Gets a string along the lines of " (x2)", corresponding to the number `i`.
11+
* For `i = 1`, the result is the empty string.
12+
*/
13+
bindingset[i]
14+
string multipleString(int i) {
15+
i = 1 and result = ""
16+
or
17+
i > 1 and result = " (x" + i.toString() + ")"
18+
}
19+
20+
from string name, int c
21+
where c = strictcount(Unextracted e | e.toString() = name)
22+
// we don't have locations, so just list the number of each type of
23+
// `Unextracted` element.
24+
select name + multipleString(c)

rust/ql/test/query-tests/diagnostics/UnextractedElements.expected

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
queries/diagnostics/UnextractedElements.ql

0 commit comments

Comments
 (0)