Skip to content

Commit b729354

Browse files
authored
Merge pull request #20704 from hvitved/rust/fix-bad-joins
Rust: Fix two bad joins
2 parents 4461be1 + b3bbe78 commit b729354

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,8 +1907,12 @@ private module MethodCallMatchingInput implements MatchingWithEnvironmentInputSi
19071907
}
19081908

19091909
pragma[nomagic]
1910-
private Type getInferredSelfType(string derefChain, boolean borrow, TypePath path) {
1911-
result = this.getACandidateReceiverTypeAt(derefChain, borrow, path)
1910+
private Type getInferredSelfType(AccessPosition apos, string derefChainBorrow, TypePath path) {
1911+
exists(string derefChain, boolean borrow |
1912+
result = this.getACandidateReceiverTypeAt(derefChain, borrow, path) and
1913+
derefChainBorrow = encodeDerefChainBorrow(derefChain, borrow) and
1914+
apos.isSelf()
1915+
)
19121916
}
19131917

19141918
pragma[nomagic]
@@ -1934,11 +1938,7 @@ private module MethodCallMatchingInput implements MatchingWithEnvironmentInputSi
19341938

19351939
bindingset[derefChainBorrow]
19361940
Type getInferredType(string derefChainBorrow, AccessPosition apos, TypePath path) {
1937-
exists(string derefChain, boolean borrow |
1938-
derefChainBorrow = encodeDerefChainBorrow(derefChain, borrow) and
1939-
apos.isSelf() and
1940-
result = this.getInferredSelfType(derefChain, borrow, path)
1941-
)
1941+
result = this.getInferredSelfType(apos, derefChainBorrow, path)
19421942
or
19431943
result = this.getInferredNonSelfType(apos, path)
19441944
}

‎shared/typeinference/codeql/typeinference/internal/TypeInference.qll‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,7 +1231,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
12311231

12321232
pragma[nomagic]
12331233
private predicate directTypeMatch0(
1234-
Access a, AccessEnvironment e, Declaration target, DeclarationPosition dpos,
1234+
Access a, DeclarationPosition dpos, AccessEnvironment e, Declaration target,
12351235
TypePath pathToTypeParam, TypeParameter tp
12361236
) {
12371237
not exists(getTypeArgument(a, target, tp, _)) and
@@ -1248,7 +1248,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
12481248
Access a, AccessEnvironment e, Declaration target, TypePath path, Type t, TypeParameter tp
12491249
) {
12501250
exists(AccessPosition apos, DeclarationPosition dpos, TypePath pathToTypeParam |
1251-
directTypeMatch0(a, e, target, dpos, pathToTypeParam, tp) and
1251+
directTypeMatch0(a, dpos, e, target, pathToTypeParam, tp) and
12521252
accessDeclarationPositionMatch(apos, dpos) and
12531253
t = a.getInferredType(e, apos, pathToTypeParam.appendInverse(path))
12541254
)
@@ -1340,7 +1340,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
13401340
}
13411341

13421342
private newtype TRelevantAccess =
1343-
MkRelevantAccess(Access a, AccessEnvironment e, AccessPosition apos, TypePath path) {
1343+
MkRelevantAccess(Access a, AccessPosition apos, AccessEnvironment e, TypePath path) {
13441344
relevantAccessConstraint(a, e, _, apos, path, _)
13451345
}
13461346

@@ -1350,11 +1350,11 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
13501350
*/
13511351
private class RelevantAccess extends MkRelevantAccess {
13521352
Access a;
1353-
AccessEnvironment e;
13541353
AccessPosition apos;
1354+
AccessEnvironment e;
13551355
TypePath path;
13561356

1357-
RelevantAccess() { this = MkRelevantAccess(a, e, apos, path) }
1357+
RelevantAccess() { this = MkRelevantAccess(a, apos, e, path) }
13581358

13591359
Type getTypeAt(TypePath suffix) {
13601360
result = a.getInferredType(e, apos, path.appendInverse(suffix))
@@ -1385,7 +1385,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
13851385
Type constraint, TypePath path, Type t
13861386
) {
13871387
exists(RelevantAccess ra |
1388-
ra = MkRelevantAccess(a, e, apos, prefix) and
1388+
ra = MkRelevantAccess(a, apos, e, prefix) and
13891389
SatisfiesConstraint<RelevantAccess, SatisfiesConstraintInput>::satisfiesConstraintType(ra,
13901390
constraint, path, t) and
13911391
constraint = ra.getConstraint(target)

0 commit comments

Comments
 (0)