-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Rust: Extend jump-to-def to include paths and mod file;
imports
#19605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1021,7 +1021,8 @@ private predicate pathAttrImport(Folder f, Module m, string relativePath) { | |||||
private predicate shouldAppend(Folder f, string relativePath) { pathAttrImport(f, _, relativePath) } | ||||||
|
||||||
/** Holds if `m` is a `mod name;` item importing file `f`. */ | ||||||
private predicate fileImport(Module m, SourceFile f) { | ||||||
pragma[nomagic] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nitpick] After marking
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
predicate fileImport(Module m, SourceFile f) { | ||||||
exists(string name, Folder parent | | ||||||
modImport0(m, name, _) and | ||||||
fileModule(f, name, parent) | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
| main.rs:2:9:2:13 | width | main.rs:5:29:5:33 | width | local variable | | ||
| main.rs:2:9:2:13 | width | main.rs:6:41:6:45 | width | local variable | | ||
| main.rs:2:9:2:13 | width | main.rs:7:36:7:40 | width | local variable | | ||
| main.rs:3:9:3:17 | precision | main.rs:5:36:5:44 | precision | local variable | | ||
| main.rs:3:9:3:17 | precision | main.rs:6:48:6:56 | precision | local variable | | ||
| main.rs:4:9:4:13 | value | main.rs:6:34:6:38 | value | local variable | | ||
| main.rs:4:9:4:13 | value | main.rs:7:29:7:33 | value | local variable | | ||
| main.rs:5:50:5:54 | value | main.rs:5:22:5:26 | value | format argument | | ||
| main.rs:6:34:6:38 | value | main.rs:6:22:6:22 | 0 | format argument | | ||
| main.rs:6:41:6:45 | width | main.rs:6:25:6:25 | 1 | format argument | | ||
| main.rs:6:48:6:56 | precision | main.rs:6:28:6:28 | 2 | format argument | | ||
| main.rs:7:29:7:33 | value | main.rs:7:21:7:22 | {} | format argument | | ||
| main.rs:7:36:7:40 | width | main.rs:7:24:7:25 | {} | format argument | | ||
| main.rs:8:9:8:14 | people | main.rs:9:22:9:27 | people | local variable | | ||
| main.rs:10:31:10:31 | 1 | main.rs:10:19:10:20 | {} | format argument | | ||
| main.rs:10:31:10:31 | 1 | main.rs:10:23:10:23 | 0 | format argument | | ||
| main.rs:10:34:10:34 | 2 | main.rs:10:16:10:16 | 1 | format argument | | ||
| main.rs:10:34:10:34 | 2 | main.rs:10:26:10:27 | {} | format argument | | ||
| main.rs:11:40:11:42 | "x" | main.rs:11:31:11:35 | {:<5} | format argument | | ||
| lib.rs:1:1:1:1 | SourceFile | main.rs:3:5:3:7 | lib | file | | ||
| main.rs:1:1:1:9 | struct S | main.rs:16:13:16:13 | S | path | | ||
| main.rs:6:9:6:13 | width | main.rs:9:29:9:33 | width | local variable | | ||
| main.rs:6:9:6:13 | width | main.rs:10:41:10:45 | width | local variable | | ||
| main.rs:6:9:6:13 | width | main.rs:11:36:11:40 | width | local variable | | ||
| main.rs:7:9:7:17 | precision | main.rs:9:36:9:44 | precision | local variable | | ||
| main.rs:7:9:7:17 | precision | main.rs:10:48:10:56 | precision | local variable | | ||
| main.rs:8:9:8:13 | value | main.rs:10:34:10:38 | value | local variable | | ||
| main.rs:8:9:8:13 | value | main.rs:11:29:11:33 | value | local variable | | ||
| main.rs:9:50:9:54 | value | main.rs:9:22:9:26 | value | format argument | | ||
| main.rs:10:34:10:38 | value | main.rs:10:22:10:22 | 0 | format argument | | ||
| main.rs:10:41:10:45 | width | main.rs:10:25:10:25 | 1 | format argument | | ||
| main.rs:10:48:10:56 | precision | main.rs:10:28:10:28 | 2 | format argument | | ||
| main.rs:11:29:11:33 | value | main.rs:11:21:11:22 | {} | format argument | | ||
| main.rs:11:36:11:40 | width | main.rs:11:24:11:25 | {} | format argument | | ||
| main.rs:12:9:12:14 | people | main.rs:13:22:13:27 | people | local variable | | ||
| main.rs:14:31:14:31 | 1 | main.rs:14:19:14:20 | {} | format argument | | ||
| main.rs:14:31:14:31 | 1 | main.rs:14:23:14:23 | 0 | format argument | | ||
| main.rs:14:34:14:34 | 2 | main.rs:14:16:14:16 | 1 | format argument | | ||
| main.rs:14:34:14:34 | 2 | main.rs:14:26:14:27 | {} | format argument | | ||
| main.rs:15:40:15:42 | "x" | main.rs:15:31:15:35 | {:<5} | format argument | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nothing on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They are there, it's just the output that is confusing ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, thanks for making it clearer! |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import codeql.rust.internal.Definitions | ||
|
||
from Definition def, Use use, string kind | ||
where def = definitionOf(use, kind) | ||
where | ||
def = definitionOf(use, kind) and | ||
use.fromSource() | ||
select def, use, kind |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The
private import rust
line does not appear to be used by this module; you may remove it to avoid unnecessary imports.Copilot uses AI. Check for mistakes.