-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
mir_build: Remove several remnants of #![feature(inline_const_pat)]
#150498
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
Conversation
|
Some changes occurred in match checking cc @Nadrieril |
compiler/rustc_middle/src/thir.rs
Outdated
| /// Pattern obtained by converting a named constant to its pattern | ||
| /// representation using `const_to_pat`. This is used by some diagnostics | ||
| /// for non-exhaustiveness. |
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 there a reason why this isn't an Option<DefId> field on Pat?
What does "diagnostics for non-exhaustiveness" mean? Is that "diagnostics uses this when emitting errors for non exhaustive matches"?
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 there a reason why this isn't an
Option<DefId>field onPat?
I was planning to investigate that approach in the future, so for now I've left a FIXME.
What does "diagnostics for non-exhaustiveness" mean? Is that "diagnostics uses this when emitting errors for non exhaustive matches"?
Yes. I've tweaked the relevant comments to hopefully be more clear.
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.
- Follow-up: I'm now hoping to remove the wrapper node kinds in THIR patterns: Replace
AscribeUserTypeandExpandedConstantwrappers with per-node data #150788.
8987520 to
c08fabc
Compare
|
r? BoxyUwU @bors r+ rollup |
c08fabc to
89f7d70
Compare
Rollup merge of #150498 - Zalathar:no-const-pat, r=BoxyUwU mir_build: Remove several remnants of `#![feature(inline_const_pat)]` This PR cleans up some THIR-related code that was only needed for inline `const { .. }` blocks in patterns. The `inline_const_pat` feature was removed in #138492 due to implementation concerns. I considered retaining the code for preserving `ExpandedConstant` for range endpoints, but ultimately decided to remove that too, because I found it very awkward to document an edge case that is currently not needed by any subsequent code. With this PR, `is_const_pat_that_looks_like_binding` is the only function that meaningfully consumes `thir::PatKind::ExpandedConst`.
THIR pattern building: Pass HIR nodes instead of loose types/spans This should make it easier to keep track of where the types/spans came from. There should be no change to compiler output. --- In the future I would also like to make more of these lowering methods return `Box<thir::Pat>` instead of `thir::PatKind`, so that it becomes feasible to add more fields to `thir::Pat` (e.g. for rust-lang#150498 (comment)). That will be easier if those methods have easy access to the corresponding HIR pattern node, from which they can obtain a type and span.
Rollup merge of #150660 - Zalathar:pass-nodes, r=davidtwco THIR pattern building: Pass HIR nodes instead of loose types/spans This should make it easier to keep track of where the types/spans came from. There should be no change to compiler output. --- In the future I would also like to make more of these lowering methods return `Box<thir::Pat>` instead of `thir::PatKind`, so that it becomes feasible to add more fields to `thir::Pat` (e.g. for #150498 (comment)). That will be easier if those methods have easy access to the corresponding HIR pattern node, from which they can obtain a type and span.
This PR cleans up some THIR-related code that was only needed for inline
const { .. }blocks in patterns. Theinline_const_patfeature was removed in #138492 due to implementation concerns.I considered retaining the code for preserving
ExpandedConstantfor range endpoints, but ultimately decided to remove that too, because I found it very awkward to document an edge case that is currently not needed by any subsequent code.With this PR,
is_const_pat_that_looks_like_bindingis the only function that meaningfully consumesthir::PatKind::ExpandedConst.