Skip to content

Commit 0158691

Browse files
committed
wip
1 parent addfd3a commit 0158691

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

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

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,6 +1630,20 @@ private module AssocFunctionResolution {
16301630
)
16311631
}
16321632

1633+
pragma[nomagic]
1634+
private predicate assocFunctionSelfInfoBlanketLikeCand(
1635+
Function f, string name, int arity, FunctionPosition selfPos, FunctionPosition selfPosAdj,
1636+
ImplItemNode impl, AssocFunctionType selfType, TypePath blanketPath, TypeParam blanketTypeParam,
1637+
TypeOption traitQualifier, boolean hasReceiver
1638+
) {
1639+
exists(Trait trait, boolean isMethod |
1640+
assocFunctionSelfInfoBlanketLike(f, name, arity, selfPos, selfPosAdj, impl, trait, selfType,
1641+
blanketPath, blanketTypeParam, isMethod) and
1642+
traitQualifier = [TypeOption::some(TTrait(trait)), any(TypeOption non | non.isNone())] and
1643+
hasReceiver = [isMethod, false]
1644+
)
1645+
}
1646+
16331647
/**
16341648
* Holds if call `afc` may target function `f` in blanket (like) implementation
16351649
* `impl` with type `selfType` at `selfPos`.
@@ -1647,11 +1661,10 @@ private module AssocFunctionResolution {
16471661
AssocFunctionCall afc, Function f, FunctionPosition selfPos, FunctionPosition selfPosAdj,
16481662
ImplItemNode impl, AssocFunctionType self, TypePath blanketPath, TypeParam blanketTypeParam
16491663
) {
1650-
exists(string name, int arity, Trait trait, boolean isMethod |
1651-
callInfo(afc, name, arity, _,
1652-
[TypeOption::some(TTrait(trait)), any(TypeOption non | non.isNone())], [false, isMethod]) and
1653-
assocFunctionSelfInfoBlanketLike(f, name, arity, selfPos, selfPosAdj, impl, trait, self,
1654-
blanketPath, blanketTypeParam, isMethod)
1664+
exists(string name, int arity, TypeOption traitQualifier, boolean hasReceiver |
1665+
callInfo(afc, name, arity, _, traitQualifier, hasReceiver) and
1666+
assocFunctionSelfInfoBlanketLikeCand(f, name, arity, selfPos, selfPosAdj, impl, self,
1667+
blanketPath, blanketTypeParam, traitQualifier, hasReceiver)
16551668
|
16561669
if not afc.hasATrait() then callVisibleImplTraitCandidate(afc, impl) else any()
16571670
)

0 commit comments

Comments
 (0)