Skip to content

Commit d72d8b6

Browse files
committed
Rust: Fix inconsistency by skipping Self in use globs
1 parent 1791c1f commit d72d8b6

File tree

3 files changed

+1
-4
lines changed

3 files changed

+1
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2135,7 +2135,7 @@ private predicate useImportEdge(Use use, string name, ItemNode item, SuccessorKi
21352135
checkQualifiedVisibility(use, item, kind1, useOpt) and
21362136
// glob imports can be shadowed
21372137
not declares(encl, ns, name) and
2138-
not name = ["super", "self"]
2138+
not name = ["super", "self", "Self"]
21392139
)
21402140
else (
21412141
item = used and

rust/ql/test/library-tests/path-resolution/CONSISTENCY/PathResolutionConsistency.expected

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,3 @@ multipleResolvedTargets
77
| main.rs:565:9:566:15 | ...::Assoc(...) |
88
| main.rs:568:9:569:12 | ...::f1(...) |
99
| main.rs:571:9:572:12 | ...::f1(...) |
10-
multiplePathResolutions
11-
| main.rs:1075:13:1074:16 | Self |

rust/ql/test/library-tests/path-resolution/path-resolution.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,6 @@ resolvePath
546546
| main.rs:1073:30:1073:32 | i32 | {EXTERNAL LOCATION} | struct i32 |
547547
| main.rs:1073:38:1073:41 | Self | main.rs:1066:5:1069:5 | enum NonEmptyListEnum |
548548
| main.rs:1074:17:1074:32 | NonEmptyListEnum | main.rs:1066:5:1069:5 | enum NonEmptyListEnum |
549-
| main.rs:1075:13:1075:16 | Self | main.rs:1066:5:1069:5 | enum NonEmptyListEnum |
550549
| main.rs:1075:13:1075:16 | Self | main.rs:1071:5:1077:5 | impl NonEmptyListEnum::<...> { ... } |
551550
| main.rs:1075:13:1075:24 | ...::Single | main.rs:1067:9:1067:17 | Single |
552551
| main.rs:1083:13:1083:16 | Copy | {EXTERNAL LOCATION} | trait Copy |

0 commit comments

Comments
 (0)