Skip to content

Commit 671bea5

Browse files
committed
Rust: Add certain type information for struct patterns
1 parent eea7006 commit 671bea5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,10 @@ module CertainTypeInference {
376376
result = se.getPath().(TypeMention).resolveTypeAt(path)
377377
}
378378

379+
private Type inferCertainStructPatType(StructPat sp, TypePath path) {
380+
result = sp.getPath().(TypeMention).resolveTypeAt(path)
381+
}
382+
379383
predicate certainTypeEquality(AstNode n1, TypePath prefix1, AstNode n2, TypePath prefix2) {
380384
prefix1.isEmpty() and
381385
prefix2.isEmpty() and
@@ -446,6 +450,8 @@ module CertainTypeInference {
446450
or
447451
result = inferCertainStructExprType(n, path)
448452
or
453+
result = inferCertainStructPatType(n, path)
454+
or
449455
result = inferRangeExprType(n) and
450456
path.isEmpty()
451457
or

0 commit comments

Comments
 (0)