Skip to content

Commit 7e74844

Browse files
committed
Rust: Implement TypeMention for paths that access associated types on concrete types
1 parent 0ac50ed commit 7e74844

File tree

5 files changed

+612
-517
lines changed

5 files changed

+612
-517
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ abstract class Type extends TType {
7575
abstract TypeParameter getPositionalTypeParameter(int i);
7676

7777
/** Gets the default type for the `i`th type parameter, if any. */
78-
TypeMention getTypeParameterDefault(int i) { none() }
78+
TypeRepr getTypeParameterDefault(int i) { none() }
7979

8080
/**
8181
* Gets a type parameter of this type.
@@ -129,7 +129,7 @@ class DataType extends Type, TDataType {
129129
result = TTypeParamTypeParameter(typeItem.getGenericParamList().getTypeParam(i))
130130
}
131131

132-
override TypeMention getTypeParameterDefault(int i) {
132+
override TypeRepr getTypeParameterDefault(int i) {
133133
result = typeItem.getGenericParamList().getTypeParam(i).getDefaultType()
134134
}
135135

@@ -189,7 +189,7 @@ class TraitType extends Type, TTrait {
189189
result.(SelfTypeParameter).getTrait() = trait
190190
}
191191

192-
override TypeMention getTypeParameterDefault(int i) {
192+
override TypeRepr getTypeParameterDefault(int i) {
193193
result = trait.getGenericParamList().getTypeParam(i).getDefaultType()
194194
}
195195

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

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

135135
module TypePath = M1::TypePath;
136136

137-
private module Input2 implements InputSig2<TypeMention> {
138-
TypeMention getABaseTypeMention(Type t) { none() }
137+
private module Input2 implements InputSig2<PreTypeMention> {
138+
PreTypeMention getABaseTypeMention(Type t) { none() }
139139

140140
Type getATypeParameterConstraint(TypeParameter tp, TypePath path) {
141141
exists(TypeMention tm | result = tm.getTypeAt(path) |
@@ -158,7 +158,7 @@ private module Input2 implements InputSig2<TypeMention> {
158158
* inference module for more information.
159159
*/
160160
predicate conditionSatisfiesConstraint(
161-
TypeAbstraction abs, TypeMention condition, TypeMention constraint, boolean transitive
161+
TypeAbstraction abs, PreTypeMention condition, PreTypeMention constraint, boolean transitive
162162
) {
163163
// `impl` blocks implementing traits
164164
transitive = false and
@@ -208,7 +208,7 @@ private module Input2 implements InputSig2<TypeMention> {
208208
}
209209
}
210210

211-
private module M2 = Make2<TypeMention, Input2>;
211+
private module M2 = Make2<PreTypeMention, Input2>;
212212

213213
import M2
214214

0 commit comments

Comments
 (0)