Skip to content

Commit 3f4bf76

Browse files
committed
Rust: Workaround for method existing both as source and as dependency
1 parent 781be8d commit 3f4bf76

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ module Impl {
3131
* ```
3232
*/
3333
class MethodCallExpr extends Generated::MethodCallExpr {
34-
override Function getStaticTarget() {
34+
private Function getStaticTargetFrom(boolean fromSource) {
3535
result = resolveMethodCallExpr(this) and
36+
(if result.fromSource() then fromSource = true else fromSource = false) and
3637
(
3738
// prioritize inherent implementation methods first
3839
isInherentImplFunction(result)
@@ -54,6 +55,13 @@ module Impl {
5455
)
5556
}
5657

58+
override Function getStaticTarget() {
59+
result = this.getStaticTargetFrom(true)
60+
or
61+
not exists(this.getStaticTargetFrom(true)) and
62+
result = this.getStaticTargetFrom(false)
63+
}
64+
5765
private string toStringPart(int index) {
5866
index = 0 and
5967
result = this.getReceiver().toAbbreviatedString()

0 commit comments

Comments
 (0)