Skip to content

Conversation

@Zalathar
Copy link
Member

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.

@rustbot
Copy link
Collaborator

rustbot commented Dec 30, 2025

Some changes occurred in match checking

cc @Nadrieril

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 30, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 30, 2025

r? @jieyouxu

rustbot has assigned @jieyouxu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

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.
Copy link
Member

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"?

Copy link
Member Author

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?

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.

@BoxyUwU
Copy link
Member

BoxyUwU commented Dec 30, 2025

r? BoxyUwU

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Dec 30, 2025

📌 Commit c08fabc has been approved by BoxyUwU

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 30, 2025
@Zalathar
Copy link
Member Author

Whoops, I pushed another tiny docs update just after the approval (diff).

@bors r=BoxyUwU

@bors
Copy link
Collaborator

bors commented Dec 30, 2025

📌 Commit 89f7d70 has been approved by BoxyUwU

It is now in the queue for this repository.

bors added a commit that referenced this pull request Dec 30, 2025
Rollup of 3 pull requests

Successful merges:

 - #146792 (Implement `TryFrom<char>` for `usize`.)
 - #150484 (Mark set_times as unavailable for RTEMS target)
 - #150498 (mir_build: Remove several remnants of `#![feature(inline_const_pat)]`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 50e6224 into rust-lang:main Dec 30, 2025
11 checks passed
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`.
@rustbot rustbot added this to the 1.94.0 milestone Dec 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants