Skip to content

Commit 3d7b60a

Browse files
committed
Rust: Add variable consistency query
1 parent d71f2de commit 3d7b60a

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* @name Variable inconsistencies
3+
* @description Lists the variable inconsistencies in the database. This query is intended for internal use.
4+
* @kind table
5+
* @id rust/diagnostics/variable-consistency
6+
*/
7+
8+
import codeql.rust.internal.VariableConsistency
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Provides logic for recognizing variable inconsistencies.
3+
*/
4+
5+
private import rust
6+
7+
query predicate multipleVariableTargets(VariableAccess va, Variable v1) {
8+
va = v1.getAnAccess() and
9+
strictcount(va.getVariable()) > 1
10+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| main.rs:367:20:367:20 | x | main.rs:364:9:364:9 | x |
2+
| main.rs:367:20:367:20 | x | main.rs:366:18:366:18 | x |

0 commit comments

Comments
 (0)