Skip to content

Commit 7fa76b7

Browse files
committed
wip
1 parent 64214f0 commit 7fa76b7

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

rust/ql/lib/codeql/rust/elements/internal/CallImpl.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@ module Impl {
8282
}
8383

8484
private predicate callHasTraitQualifier(CallExpr call, Trait qualifier) {
85-
exists(Path qualifierPath |
85+
exists(RelevantPath qualifierPath |
8686
callHasQualifier(call, _, qualifierPath) and
8787
qualifier = resolvePath(qualifierPath) and
8888
// When the qualifier is `Self` and resolves to a trait, it's inside a
8989
// trait method's default implementation. This is not a dispatch whose
9090
// target is inferred from the type of the receiver, but should always
9191
// resolve to the function in the trait block as path resolution does.
92-
not qualifierPath.(RelevantPath).isUnqualified("Self")
92+
not qualifierPath.isUnqualified("Self")
9393
)
9494
}
9595

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,12 +1547,19 @@ private predicate assocFuncResolutionDependsOnArgument(Function f, Impl impl, in
15471547
private class FunctionCallExpr extends CallImpl::CallExprCall {
15481548
ItemNode getResolvedFunction() { result = CallExprImpl::getResolvedFunction(this) }
15491549

1550+
/**
1551+
* Holds if the target of this call is ambigous, and type information is required
1552+
* to disambiguate.
1553+
*/
15501554
predicate isAmbigous() {
15511555
this.hasTrait()
15521556
or
15531557
assocFuncResolutionDependsOnArgument(this.getResolvedFunction(), _, _)
15541558
}
15551559

1560+
/**
1561+
* Gets a target candidate of this ambigous call.
1562+
*/
15561563
pragma[nomagic]
15571564
Function getAnAmbigousCandidate(ImplItemNode impl, int pos, Function f) {
15581565
exists(TraitItemNode trait |

0 commit comments

Comments
 (0)