Skip to content

Commit 81dbff5

Browse files
committed
inf
1 parent 85b5638 commit 81dbff5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3235,7 +3235,7 @@ private Type getFieldExprLookupType(FieldExpr fe, string name, DerefChain derefC
32353235
derefChain = DerefChain::nil()
32363236
or
32373237
exists(DerefImplItemNode impl, TypeParamTypeParameter tp |
3238-
tp.getTypeParam() = impl.resolveSelfTy().getTypeParam(0) and
3238+
tp = impl.getFirstSelfTypeParameter() and
32393239
path.getHead() = tp and
32403240
derefChain = DerefChain::singleton(impl)
32413241
)

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ class DerefImplItemNode extends ImplItemNode {
4141
path0.isCons(getRefTypeParameter(false), path)
4242
)
4343
}
44+
45+
/** Gets the first type parameter of the type being implemented, if any. */
46+
pragma[nomagic]
47+
TypeParamTypeParameter getFirstSelfTypeParameter() {
48+
result.getTypeParam() = this.resolveSelfTy().getTypeParam(0)
49+
}
4450
}
4551

4652
private module UnboundListInput implements UnboundListImpl::InputSig<Location> {

0 commit comments

Comments
 (0)