mir_build: Remove several remnants of #![feature(inline_const_pat)]#150498
Merged
bors merged 2 commits intorust-lang:mainfrom Dec 30, 2025
Merged
mir_build: Remove several remnants of #![feature(inline_const_pat)]#150498bors merged 2 commits intorust-lang:mainfrom
#![feature(inline_const_pat)]#150498bors merged 2 commits intorust-lang:mainfrom
Conversation
Collaborator
|
Some changes occurred in match checking cc @Nadrieril |
Collaborator
BoxyUwU
reviewed
Dec 30, 2025
compiler/rustc_middle/src/thir.rs
Outdated
Comment on lines
835
to
837
| /// Pattern obtained by converting a named constant to its pattern | ||
| /// representation using `const_to_pat`. This is used by some diagnostics | ||
| /// for non-exhaustiveness. |
Member
There was a problem hiding this comment.
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"?
Member
Author
There was a problem hiding this comment.
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.
Member
Author
There was a problem hiding this comment.
- 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
Member
|
r? BoxyUwU @bors r+ rollup |
Collaborator
c08fabc to
89f7d70
Compare
Member
Author
Collaborator
rust-timer
added a commit
that referenced
this pull request
Dec 30, 2025
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`.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Jan 4, 2026
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.
rust-timer
added a commit
that referenced
this pull request
Jan 4, 2026
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.