Skip to content

Commit 9f8a3ab

Browse files
committed
Rust: Add another type inference debug predicate
1 parent 75caa18 commit 9f8a3ab

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

rust/ql/lib/codeql/rust/internal/TypeInference.qll

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,4 +1516,15 @@ private module Debug {
15161516
mce = getRelevantLocatable() and
15171517
result = resolveMethodCallTarget(mce)
15181518
}
1519+
1520+
pragma[nomagic]
1521+
private int countTypes(AstNode n, TypePath path, Type t) {
1522+
t = inferType(n, path) and
1523+
result = strictcount(Type t0 | t0 = inferType(n, path))
1524+
}
1525+
1526+
predicate maxTypes(AstNode n, TypePath path, Type t, int c) {
1527+
c = countTypes(n, path, t) and
1528+
c = max(countTypes(_, _, _))
1529+
}
15191530
}

0 commit comments

Comments
 (0)