-
Notifications
You must be signed in to change notification settings - Fork 13k
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
rustc_ast_lowering: Stop lowering imports into multiple items #104963
Conversation
r? @wesleywiser (rustbot has picked a reviewer for you, use r? to override) |
Some changes occurred in src/tools/rustfmt cc @rust-lang/rustfmt Some changes occurred in src/librustdoc/clean/types.rs cc @camelid Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit b93c4dca5cb7d1e000b67d3028c1e64d8a207ecf with merge 92fa2a1be7dd7730c2f2fe2f6c0ea4c1568bf834... |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
b93c4dc
to
04eabb0
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 04eabb0d387ea54e53e513ba96d2d2cd1fc1aacd with merge 95e6cf06dca55add53a600d4152451a00fb84128... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (95e6cf06dca55add53a600d4152451a00fb84128): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
|
04eabb0
to
00ce328
Compare
@rustbot ready |
This comment was marked as resolved.
This comment was marked as resolved.
Lower them into a single item with multiple resolutions instead. This also allows to remove additional `NodId`s and `DefId`s related to those additional items.
00ce328
to
b32a4ed
Compare
@rustbot ready |
@bors r+ |
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.
Small review on the Clippy changes.
@@ -176,7 +176,8 @@ impl LateLintPass<'_> for WildcardImports { | |||
format!("{import_source_snippet}::{imports_string}") | |||
}; | |||
|
|||
let (lint, message) = if let Res::Def(DefKind::Enum, _) = use_path.res { | |||
// Glob imports always have a single resolution. | |||
let (lint, message) = if let Res::Def(DefKind::Enum, _) = use_path.res[0] { |
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.
This could be when already matching anyway. A little bit safer.
let (lint, message) = if let Res::Def(DefKind::Enum, _) = use_path.res[0] { | |
let (lint, message) = if let Some(Res::Def(DefKind::Enum, _)) = use_path.res.get(0) { |
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.
If glob import doesn't have a resolution (for its prefix) then something unexpected is happening, so it should be fine to leae this as indexing.
@@ -1,8 +1,8 @@ | |||
error: `macro_use` attributes are no longer needed in the Rust 2018 edition | |||
--> $DIR/macro_use_imports.rs:23:5 | |||
--> $DIR/macro_use_imports.rs:25:5 |
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.
Those two error messages got swapped around. Weird 🤔
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.
They are reported in a different order now, due to a different order of DefId
s assigned by def collector, most probably.
☀️ Test successful - checks-actions |
Finished benchmarking commit (11663b1): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
|
rustc_ast_lowering: Stop lowering imports into multiple items Lower them into a single item with multiple resolutions instead. This also allows to remove additional `NodId`s and `DefId`s related to those additional items.
Lower them into a single item with multiple resolutions instead.
This also allows to remove additional
NodId
s andDefId
s related to those additional items.