-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
resolve: Do not build expensive suggestions if they are not actually used #95255
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 7e878bb75e2a91159cb6a3f2e4cbabf09fdbb9b1 with merge 5ef703f1b77179a2f29e24ea3e1775a23765725c... |
@@ -568,7 +568,7 @@ fn configure_cmake( | |||
// We also do this if the user explicitly requested static libstdc++. | |||
if builder.config.llvm_static_stdcpp { | |||
if !target.contains("msvc") && !target.contains("netbsd") { | |||
if target.contains("apple") { |
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 looks like unintended change
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 is a drive-by fix for #94832 (comment) without which Rust doesn't build on my machine.
UPD: submitted as a separate PR in #95266.
☀️ Try build successful - checks-actions |
Queued 5ef703f1b77179a2f29e24ea3e1775a23765725c with parent 9f4dc0b, future comparison URL. |
Finished benchmarking commit (5ef703f1b77179a2f29e24ea3e1775a23765725c): comparison url. Summary: This benchmark run shows 35 relevant improvements 🎉 to instruction counts.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking 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 led to changes in compiler perf. @bors rollup=never |
compiler/rustc_resolve/src/lib.rs
Outdated
#[derive(Copy, Clone, PartialEq, Debug)] | ||
enum CrateLint { | ||
#[derive(Copy, Clone, Debug)] | ||
enum RecordUsed { |
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.
Maybe this enum should have some different name.
It should be short because it's used often.
There are two path resolution modes:
- Speculative mode - we only return the result, but do not report errors or lints, and do not do recovery
- Non-speculative mode - we report errors, do recovery when possible, also report lints, and mark path targets as used (the
record_used
naming comes from this). That's why need some extra data like a node id for linting or a span in this mode.
Maybe call it enum Finalize
?
It's two letters shorter, not as specific as the old "record used" naming, and we use "finalize" elsewhere in resolve for similar functionality, like fn finalize_(imports,macro_resolutions)
.
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.
Maybe something like
enum Mode {
Speculative,
Finalize
}
?
enum Finalize
looks OK to me though.
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.
I've renamed everything to Finalize
/finalize
, but kept it a single flat enum (with Finalize::No
variant), otherwise it becomes too annoying to both construct and unwrap it.
Let me know when this is ready for review 👍 |
@michaelwoerister |
This looks like some great cleanup work. Lots of duplicate error messages being removed too. |
…used Also remove a redundant parameter from `fn resolve_path(_with_ribs)`, `crate_lint: CrateLint` is a more detailed version of `record_used: bool` with `CrateLint::No` meaning `false` and anything else meaning `true`.
Do not construct or pass unused data
And `crate_lint`/`record_used` to `finalize`
7e878bb
to
1ad64a2
Compare
No, nothing too deep happens here, I mostly wanted some second opinion on naming. |
OK, looks good to me. |
📌 Commit 1ad64a2 has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (903427b): comparison url. Summary: This benchmark run shows 33 relevant improvements 🎉 to instruction counts.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
resolve: Cleanup path resolution finalization Some cleanup after rust-lang#95255 and rust-lang#95405. r? `@cjgillot`
And remove a bunch of (conditionally) unused parameters from path resolution functions.
This helps with performance issues in #94857, and should be helpful in general even without that.