Skip to content

Commit 5e9dade

Browse files
committed
Rust: Start canonical path part indices at zero
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4e7f3f7f-82b3-403c-93fa-984f56c89a70
1 parent a7186e5 commit 5e9dade

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,32 +1104,32 @@ final class TraitItemNode extends ImplOrTraitItemNode, NamedItemNode, TypeItemNo
11041104

11051105
bindingset[c]
11061106
private string getCanonicalPathPart(Crate c, int i) {
1107-
i = -1 and
1107+
i = 0 and
11081108
result = "<"
11091109
or
1110-
i = 0 and
1110+
i = 1 and
11111111
result = this.getCanonicalPathPrefix(c)
11121112
or
1113-
i = 1 and
1113+
i = 2 and
11141114
result = "::"
11151115
or
1116-
i = 2 and
1116+
i = 3 and
11171117
result = this.getName()
11181118
or
1119-
i = 3 and
1119+
i = 4 and
11201120
result = ">"
11211121
}
11221122

11231123
language[monotonicAggregates]
11241124
override string getCanonicalPath(Crate c) {
11251125
this.hasCanonicalPath(c) and
1126-
result = strictconcat(int i | i in [0 .. 2] | this.getCanonicalPathPart(c, i) order by i)
1126+
result = strictconcat(int i | i in [1 .. 3] | this.getCanonicalPathPart(c, i) order by i)
11271127
}
11281128

11291129
language[monotonicAggregates]
11301130
override string getCanonicalPathPrefixFor(Crate c, ItemNode child) {
11311131
this.providesCanonicalPathPrefixFor(c, child) and
1132-
result = strictconcat(int i | i in [-1 .. 3] | this.getCanonicalPathPart(c, i) order by i)
1132+
result = strictconcat(int i | i in [0 .. 4] | this.getCanonicalPathPart(c, i) order by i)
11331133
}
11341134
}
11351135

0 commit comments

Comments
 (0)