@@ -89,6 +89,26 @@ query predicate multiplePathResolutions(Path p, ItemNode i) {
8989 strictcount ( resolvePath ( p ) ) > 1
9090}
9191
92+ /** Holds if `call` has multiple static call targets including `target`. */
93+ query predicate multipleStaticCallTargets ( CallExprBase call , Callable target ) {
94+ target = call .getStaticTarget ( ) and
95+ strictcount ( call .getStaticTarget ( ) ) > 1
96+ }
97+
98+ /** Holds if `fe` resolves to multiple record fields including `field`. */
99+ query predicate multipleRecordFields ( FieldExpr fe , RecordField field ) {
100+ field = fe .getRecordField ( ) and
101+ strictcount ( fe .getRecordField ( ) ) > 1
102+ }
103+
104+ /** Holds if `fe` resolves to multiple tuple fields including `field`. */
105+ query predicate multipleTupleFields ( FieldExpr fe , TupleField field ) {
106+ field = fe .getTupleField ( ) and
107+ strictcount ( fe .getTupleField ( ) ) > 1
108+ }
109+
110+ import codeql.rust.elements.internal.TypeInference:: Consistency
111+
92112/**
93113 * Gets counts of abstract syntax tree inconsistencies of each type.
94114 */
@@ -117,4 +137,13 @@ int getAstInconsistencyCounts(string type) {
117137 or
118138 type = "Multiple path resolutions" and
119139 result = count ( Path p | multiplePathResolutions ( p , _) | p )
140+ or
141+ type = "Multiple static call targets" and
142+ result = count ( CallExprBase call | multipleStaticCallTargets ( call , _) | call )
143+ or
144+ type = "Multiple record fields" and
145+ result = count ( FieldExpr fe | multipleRecordFields ( fe , _) | fe )
146+ or
147+ type = "Multiple tuple fields" and
148+ result = count ( FieldExpr fe | multipleTupleFields ( fe , _) | fe )
120149}
0 commit comments