Skip to content

Commit 7100ca4

Browse files
committed
Rust: Adapt to changes in shared type inference library
1 parent a7fecaa commit 7100ca4

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,8 @@ class TypePath = M1::TypePath;
134134

135135
module TypePath = M1::TypePath;
136136

137-
private module Input2 implements InputSig2 {
138-
private import TypeMention as TM
139-
140-
class TypeMention = TM::TypeMention;
141-
142-
TypeMention getABaseTypeMention(Type t) { none() }
137+
private module Input2 implements InputSig2<TypeMentionTypeTree> {
138+
TypeMentionTypeTree getABaseTypeMention(Type t) { none() }
143139

144140
Type getATypeParameterConstraint(TypeParameter tp, TypePath path) {
145141
exists(TypeMention tm | result = tm.resolveTypeAt(path) |
@@ -162,7 +158,8 @@ private module Input2 implements InputSig2 {
162158
* inference module for more information.
163159
*/
164160
predicate conditionSatisfiesConstraint(
165-
TypeAbstraction abs, TypeMention condition, TypeMention constraint, boolean transitive
161+
TypeAbstraction abs, TypeMentionTypeTree condition, TypeMentionTypeTree constraint,
162+
boolean transitive
166163
) {
167164
// `impl` blocks implementing traits
168165
transitive = false and
@@ -212,7 +209,7 @@ private module Input2 implements InputSig2 {
212209
}
213210
}
214211

215-
private module M2 = Make2<Input2>;
212+
private module M2 = Make2<TypeMentionTypeTree, Input2>;
216213

217214
import M2
218215

rust/ql/lib/codeql/rust/internal/typeinference/TypeMention.qll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ abstract class TypeMention extends AstNode {
1818
final Type resolveType() { result = this.resolveTypeAt(TypePath::nil()) }
1919
}
2020

21+
final private class FinalTypeMention = TypeMention;
22+
23+
/** An adapter for type mentions to implement `HasTypeTreeSig`. */
24+
final class TypeMentionTypeTree extends FinalTypeMention {
25+
Type getTypeAt(TypePath path) { result = this.resolveTypeAt(path) }
26+
}
27+
2128
class TupleTypeReprMention extends TypeMention instanceof TupleTypeRepr {
2229
override Type resolveTypeAt(TypePath path) {
2330
path.isEmpty() and

0 commit comments

Comments
 (0)