Skip to content

Commit 368ae80

Browse files
committed
wip
1 parent 719c71d commit 368ae80

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1350,7 +1350,10 @@ private predicate pathUsesNamespace(Path p, Namespace n) {
13501350
/** Gets the item that `path` resolves to, if any. */
13511351
cached
13521352
ItemNode resolvePath(RelevantPath path) {
1353-
exists(Namespace ns | result = resolvePath0(path, ns, _) |
1353+
exists(Namespace ns |
1354+
result = resolvePath0(path, ns, _) and
1355+
if path = any(ImplItemNode i).getSelfPath() then not result instanceof TraitItemNode else any()
1356+
|
13541357
pathUsesNamespace(path, ns)
13551358
or
13561359
not pathUsesNamespace(path, _) and

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,9 @@ private import M2
224224
module Consistency {
225225
import M2::Consistency
226226

227-
query predicate nonUniqueCertainType(AstNode n, TypePath path) {
228-
strictcount(CertainTypeInference::inferCertainType(n, path)) > 1
227+
query predicate nonUniqueCertainType(AstNode n, TypePath path, Type t) {
228+
strictcount(CertainTypeInference::inferCertainType(n, path)) > 1 and
229+
t = CertainTypeInference::inferCertainType(n, path)
229230
}
230231
}
231232

@@ -2484,7 +2485,6 @@ private module Debug {
24842485

24852486
Type debugInferCertainNonUniqueType(AstNode n, TypePath path) {
24862487
n = getRelevantLocatable() and
2487-
Consistency::nonUniqueCertainType(n, path) and
2488-
result = CertainTypeInference::inferCertainType(n, path)
2488+
Consistency::nonUniqueCertainType(n, path, result)
24892489
}
24902490
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ int getTypeInferenceInconsistencyCounts(string type) {
3131
result = count(TypeMention tm | illFormedTypeMention(tm) | tm)
3232
or
3333
type = "Non-unique certain type information" and
34-
result = count(AstNode n, TypePath path | nonUniqueCertainType(n, path) | n)
34+
result = count(AstNode n, TypePath path | nonUniqueCertainType(n, path, _) | n)
3535
}

0 commit comments

Comments
 (0)