diff --git a/rust/ql/lib/codeql/rust/internal/typeinference/TypeInference.qll b/rust/ql/lib/codeql/rust/internal/typeinference/TypeInference.qll index ebf7bd2aa82..e2b687a0079 100644 --- a/rust/ql/lib/codeql/rust/internal/typeinference/TypeInference.qll +++ b/rust/ql/lib/codeql/rust/internal/typeinference/TypeInference.qll @@ -134,12 +134,8 @@ class TypePath = M1::TypePath; module TypePath = M1::TypePath; -private module Input2 implements InputSig2 { - private import TypeMention as TM - - class TypeMention = TM::TypeMention; - - TypeMention getABaseTypeMention(Type t) { none() } +private module Input2 implements InputSig2 { + TypeMentionTypeTree getABaseTypeMention(Type t) { none() } Type getATypeParameterConstraint(TypeParameter tp, TypePath path) { exists(TypeMention tm | result = tm.resolveTypeAt(path) | @@ -162,7 +158,8 @@ private module Input2 implements InputSig2 { * inference module for more information. */ predicate conditionSatisfiesConstraint( - TypeAbstraction abs, TypeMention condition, TypeMention constraint, boolean transitive + TypeAbstraction abs, TypeMentionTypeTree condition, TypeMentionTypeTree constraint, + boolean transitive ) { // `impl` blocks implementing traits transitive = false and @@ -212,7 +209,7 @@ private module Input2 implements InputSig2 { } } -private module M2 = Make2; +private module M2 = Make2; import M2 diff --git a/rust/ql/lib/codeql/rust/internal/typeinference/TypeMention.qll b/rust/ql/lib/codeql/rust/internal/typeinference/TypeMention.qll index 063e9beffd3..7e5abaa5a3a 100644 --- a/rust/ql/lib/codeql/rust/internal/typeinference/TypeMention.qll +++ b/rust/ql/lib/codeql/rust/internal/typeinference/TypeMention.qll @@ -18,6 +18,13 @@ abstract class TypeMention extends AstNode { final Type resolveType() { result = this.resolveTypeAt(TypePath::nil()) } } +final private class FinalTypeMention = TypeMention; + +/** An adapter for type mentions to implement `HasTypeTreeSig`. */ +final class TypeMentionTypeTree extends FinalTypeMention { + Type getTypeAt(TypePath path) { result = this.resolveTypeAt(path) } +} + class TupleTypeReprMention extends TypeMention instanceof TupleTypeRepr { override Type resolveTypeAt(TypePath path) { path.isEmpty() and