Skip to content

Commit 0216c76

Browse files
committed
wip
1 parent 507bbf5 commit 0216c76

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,9 +394,7 @@ abstract private class ModuleLikeNode extends ItemNode {
394394

395395
private class SourceFileItemNode extends ModuleLikeNode, SourceFile {
396396
pragma[nomagic]
397-
ModuleLikeNode getSuper() {
398-
result = any(ModuleItemNode mod | fileImport(mod, this)).getASuccessor("super")
399-
}
397+
ModuleLikeNode getSuper() { fileImport(result.getAnItemInScope(), this) }
400398

401399
override string getName() { result = "(source file)" }
402400

@@ -1506,6 +1504,13 @@ private ItemNode resolvePathCandQualifier(RelevantPath qualifier, RelevantPath p
15061504
name = path.getText()
15071505
}
15081506

1507+
pragma[nomagic]
1508+
private Crate getCrate0(Locatable l) { result.getASourceFile().getFile() = l.getFile() }
1509+
1510+
bindingset[l]
1511+
pragma[inline_late]
1512+
private Crate getCrate(Locatable l) { result = getCrate0(l) }
1513+
15091514
/**
15101515
* Gets the item that `path` resolves to in `ns` when `qualifier` is the
15111516
* qualifier of `path` and `qualifier` resolves to `q`, if any.
@@ -1520,7 +1525,8 @@ private ItemNode resolvePathCandQualified(
15201525
|
15211526
kind.isExternalOrBoth()
15221527
or
1523-
qualifier.getText() = "super"
1528+
getCrate(path) = getCrate(result) and
1529+
not result instanceof TypeParam
15241530
)
15251531
}
15261532

0 commit comments

Comments
 (0)