-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
[DO NOT MERGE] Enable exhaustive_patterns
by default
#79394
Conversation
r? @estebank (rust-highfive has picked a reviewer for you, use r? to override) |
r? @ghost |
7fa508e
to
bf6f447
Compare
It seems like this feature doesn't work right with
|
|
bf6f447
to
a004002
Compare
I see, it literally can't be constructed. I forgot about that :) I removed the match arm and asked in #wg-traits what the purpose of that variant is. |
a004002
to
ea30582
Compare
Bootstrapping compilers are so weird 😄 |
try doesn't care about tests @bors try @rust-timer queue |
Awaiting bors try build completion |
⌛ Trying commit ea30582cd3597054cf556cc8c695c89ca391fbce with merge 0a6c0a7ffa7f6640700cf2da97187fad8711a6d1... |
☀️ Try build successful - checks-actions |
Queued 0a6c0a7ffa7f6640700cf2da97187fad8711a6d1 with parent ec039bd, future comparison URL. |
Finished benchmarking try commit (0a6c0a7ffa7f6640700cf2da97187fad8711a6d1): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
It seems |
Ouch ok. The feature only removes possible branches, so it shouldn't affect performance of the exhaustiveness algorithm itself. Thus the blame seems to lie in the inhabitedness check, as noticed here. |
Same here, and I would be interested in following along so I understand it better (or at all) :) |
I have to admit that whenever I've worked with queries in the past, I've just followed my nose based on how existing queries have been implemented :) It sounds worth a try to me, though! |
Queued d344606ba6e6c745d677da8ae46f754ec61e5d98 with parent 5be3f9f, future comparison URL. |
Finished benchmarking try commit (d344606ba6e6c745d677da8ae46f754ec61e5d98): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
Looks like with @Nadrieril's great work on performance, we may now be able to finally stabilize this feature! 🎉 Though I think there might have been some other concerns not related to performance? Though I think they also can be resolved in a backwards-compatible way? |
Well I'm waiting on an answer to the never patterns issue that I summarized. This feature is probably introducing unsoundness, which is very not good. |
My current plan is to wait for a reply to #78123 and comment in #51085 explaining that the feature probably introduces unsoundness, depending on future plans of what is and isn't UB. I expect we will have to turn never patterns into a proper RFC before we can stabilize |
Turn type inhabitedness into a query to fix `exhaustive_patterns` perf We measured in rust-lang#79394 that enabling the [`exhaustive_patterns` feature](rust-lang#51085) causes significant perf degradation. It was conjectured that the culprit is type inhabitedness checking, and [I hypothesized](rust-lang#79394 (comment)) that turning this computation into a query would solve most of the problem. This PR turns `tcx.is_ty_uninhabited_from` into a query, and I measured a 25% perf gain on the benchmark that stress-tests `exhaustiveness_patterns`. This more than compensates for the 30% perf hit I measured [when creating it](rust-lang/rustc-perf#801). We'll have to measure enabling the feature again, but I suspect this fixes the perf regression entirely. I'd like a perf run on this PR obviously. I made small atomic commits to help reviewing. The first one is just me discovering the "revisions" feature of the testing framework. I believe there's a push to move things out of `rustc_middle` because it's huge. I guess `inhabitedness/mod.rs` could be moved out, but it's quite small. `DefIdForest` might be movable somewhere too. I don't know what the policy is for that. Ping `@camelid` since you were interested in following along `@rustbot` modify labels: +A-exhaustiveness-checking
#79670 got merged! Let's measure again. @bors try @rust-timer queue |
Awaiting bors try build completion. |
🔒 Merge conflict This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again. How do I rebase?Assuming
You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial. Please avoid the "Resolve conflicts" button on GitHub. It uses Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Error message
|
I resolved the conflicts myself using the GitHub interface; it's nice! |
Awaiting bors try build completion. |
⌛ Trying commit eb4a187 with merge 82e461272563be4e708e0a70d043653baed29179... |
The job Click to see the possible cause of the failure (guessed by this bot)
|
☀️ Try build successful - checks-actions |
Queued 82e461272563be4e708e0a70d043653baed29179 with parent fd2df74, future comparison URL. @rustbot label: +S-waiting-on-perf |
Finished benchmarking try commit (82e461272563be4e708e0a70d043653baed29179): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
Overall, perf looks neutral! Perhaps very slight regressions, but I think within the margin of error. Thanks to @Nadrieril for putting in the work to speed it up! |
@camelid What's the plan for this going forward? Is there more to do or does this just need a review/decision? (I see that CI failed last run, but logs are expired) |
This was just an experiment to see what the perf situation was; I didn't close it because I wasn't sure if people wanted to do more tests with it. I believe what's left is making a decision about stabilization; @Nadrieril may know more. |
Performance used to be a blocker for the |
cc #51085
This doesn't stabilize the feature, it just makes it a no-op. This is to
get a perf run as suggested here.
cc @varkor