-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[Experiment] Split exhaustiveness logic into its own crate #89570
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
[Experiment] Split exhaustiveness logic into its own crate #89570
Conversation
r? @estebank (rust-highfive has picked a reviewer for you, use r? to override) |
r? @ghost |
And in the process greatly clarify how they're handled.
Instead of going through the complicated `IntRange` logic
Also rework const evaluation a bit
edde94a
to
ec2324b
Compare
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit ec2324b with merge d333b4430fb1577f7c0f0e650ac2f49a6fd04048... |
The job Click to see the possible cause of the failure (guessed by this bot)
|
☀️ Try build successful - checks-actions |
Queued d333b4430fb1577f7c0f0e650ac2f49a6fd04048 with parent 25ec827, future comparison URL. |
Finished benchmarking commit (d333b4430fb1577f7c0f0e650ac2f49a6fd04048): comparison url. Summary: This change led to moderate relevant regressions 😿 in compiler performance.
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. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never |
This is exciting! |
use Constructor::*; | ||
match pat.ctor() { | ||
Wildcard => true, | ||
Single => pat.iter_fields().all(|pat| pat_is_catchall(pat)), | ||
Single | Tuple(_) | Ref(_) | BoxPat(_) => pat.iter_fields().all(|pat| pat_is_catchall(pat)), |
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.
Is this a bugfix?
This seems like it might be a source of performance impact.
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.
No, this is because I split the Single
case into more specific subcases so that I could abstract it all in a trait. I suspected this could be the source of perf degradation but my local measurements don't show much impact from this.
The problem of course is that my local measurements don't match what rust-timer
reports here so you could be right. When I get back to this I'll measure intermediate commits with rust-timer
.
(I still intend get this done. Will get back to it whenever my work deadlines are done and motivation strikes) |
Closing this as it is inactive |
rust-analyzer
currently maintains a patched copy of the exhaustiveness algorithm for their own analyses. That's too bad, so I factored out everything rustc-specific from the relevant files. If perf isn't killed, I'll move it into its own crate.Until the type library gets librarified, there'll still be some nontrivial code that rust-analyzer will have to duplicate. But the core functionality will be shared and we should be able to implement cool features for the rust-analyzer side.