Skip to content

Comments

reject inline const patterns pre-expansion#152548

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
dianne:reject-const-block-pat-pre-expansion
Feb 13, 2026
Merged

reject inline const patterns pre-expansion#152548
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
dianne:reject-const-block-pat-pre-expansion

Conversation

@dianne
Copy link
Contributor

@dianne dianne commented Feb 12, 2026

Reverts the parser changes from #149667

Fixes #152499

Awkwardly, some cases of inline const pats can only be caught pre-expansion and some can only be caught post-expansion. #149667 switched from only rejecting the former to only rejecting the latter.

@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 Feb 12, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 12, 2026

r? @nnethercote

rustbot has assigned @nnethercote.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 68 candidates
  • Random selection from 17 candidates

@dianne dianne added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Feb 12, 2026
@fmease fmease assigned fmease and unassigned nnethercote Feb 12, 2026
Copy link
Member

@fmease fmease left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix! @bors r+ rollup

View changes since this review

Copy link
Member

@fmease fmease Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awkwardly, some cases of inline const pats can only be caught pre-expansion and some can only be caught post-expansion. #149667 switched from only rejecting the former to only rejecting the latter.

The existence of PatKind::Expr / $e:expr being allowed to be inserted into pats continues to make me sad.

Diagnostic stashing+stealing would allow us to use the diagnostic note (use a named …) from AST lowering again, instead of duplicating it here … at the cost of not showing this help under #[cfg(false)]. Might be overkill tho (and it definitely shouldn't be done in this PR).

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 12, 2026

📌 Commit 60f802f has been approved by fmease

It is now in the queue for this repository.

@rust-bors rust-bors bot 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 Feb 12, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 12, 2026
…expansion, r=fmease

reject inline const patterns pre-expansion

Reverts the parser changes from rust-lang#149667

Fixes rust-lang#152499

Awkwardly, some cases of inline const pats can only be caught pre-expansion and some can only be caught post-expansion. rust-lang#149667 switched from only rejecting the former to only rejecting the latter.
rust-bors bot pushed a commit that referenced this pull request Feb 12, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - #146901 (Support AVRTiny devices in AVR inline assembly)
 - #150988 (Improve code suggestion for incorrect macro_rules! usage)
 - #152422 (Change query proc macro to be more rust-analyzer friendly)
 - #152496 (Fix multi-cgu+debug builds using autodiff by delaying autodiff till lto)
 - #152520 (Don't use `DepContext` in `rustc_middle::traits::cache`)
 - #152528 (Support serializing CodegenContext)
 - #152082 (Move tests)
 - #152444 (`-Znext-solver` Prevent committing unfulfilled unsized coercion)
 - #152486 (remove redundant backchain attribute in codegen)
 - #152529 (sparc64: enable abi compatibility test)
 - #152548 (reject inline const patterns pre-expansion)
Zalathar added a commit to Zalathar/rust that referenced this pull request Feb 13, 2026
…expansion, r=fmease

reject inline const patterns pre-expansion

Reverts the parser changes from rust-lang#149667

Fixes rust-lang#152499

Awkwardly, some cases of inline const pats can only be caught pre-expansion and some can only be caught post-expansion. rust-lang#149667 switched from only rejecting the former to only rejecting the latter.
rust-bors bot pushed a commit that referenced this pull request Feb 13, 2026
Rollup of 18 pull requests

Successful merges:

 - #150551 (Compute localized outlives constraints lazily)
 - #150752 (Update libc to v0.2.181)
 - #150988 (Improve code suggestion for incorrect macro_rules! usage)
 - #152422 (Change query proc macro to be more rust-analyzer friendly)
 - #152496 (Fix multi-cgu+debug builds using autodiff by delaying autodiff till lto)
 - #152514 (Collect active query jobs into struct `QueryJobMap`)
 - #152520 (Don't use `DepContext` in `rustc_middle::traits::cache`)
 - #152528 (Support serializing CodegenContext)
 - #152082 (Move tests)
 - #152232 (Add must_use for FileTimes)
 - #152329 (Simplify parallel! macro)
 - #152444 (`-Znext-solver` Prevent committing unfulfilled unsized coercion)
 - #152486 (remove redundant backchain attribute in codegen)
 - #152519 (Fix feature gating for new `try bikeshed` expressions)
 - #152529 (sparc64: enable abi compatibility test)
 - #152548 (reject inline const patterns pre-expansion)
 - #152550 (Port #[prelude_import] to the attribute parser)
 - #152552 (Add 2048-bit HvxVectorPair support to Hexagon SIMD ABI checks)
rust-bors bot pushed a commit that referenced this pull request Feb 13, 2026
Rollup of 17 pull requests

Successful merges:

 - #150551 (Compute localized outlives constraints lazily)
 - #150988 (Improve code suggestion for incorrect macro_rules! usage)
 - #152422 (Change query proc macro to be more rust-analyzer friendly)
 - #152496 (Fix multi-cgu+debug builds using autodiff by delaying autodiff till lto)
 - #152514 (Collect active query jobs into struct `QueryJobMap`)
 - #152520 (Don't use `DepContext` in `rustc_middle::traits::cache`)
 - #152528 (Support serializing CodegenContext)
 - #152082 (Move tests)
 - #152232 (Add must_use for FileTimes)
 - #152329 (Simplify parallel! macro)
 - #152444 (`-Znext-solver` Prevent committing unfulfilled unsized coercion)
 - #152486 (remove redundant backchain attribute in codegen)
 - #152519 (Fix feature gating for new `try bikeshed` expressions)
 - #152529 (sparc64: enable abi compatibility test)
 - #152548 (reject inline const patterns pre-expansion)
 - #152550 (Port #[prelude_import] to the attribute parser)
 - #152552 (Add 2048-bit HvxVectorPair support to Hexagon SIMD ABI checks)

Failed merges:

 - #152515 (Extract `DepKindVTable` constructors to their own module)
@rust-bors rust-bors bot merged commit 5266800 into rust-lang:main Feb 13, 2026
11 checks passed
rust-timer added a commit that referenced this pull request Feb 13, 2026
Rollup merge of #152548 - dianne:reject-const-block-pat-pre-expansion, r=fmease

reject inline const patterns pre-expansion

Reverts the parser changes from #149667

Fixes #152499

Awkwardly, some cases of inline const pats can only be caught pre-expansion and some can only be caught post-expansion. #149667 switched from only rejecting the former to only rejecting the latter.
@apiraino
Copy link
Contributor

Beta backport accepted as per compiler team on Zulip. A backport PR will be authored by the release team at the end of the current development cycle. Backport labels handled by them.

@rustbot label +beta-accepted

@rustbot rustbot added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Feb 19, 2026
@cuviper cuviper added this to the 1.95.0 milestone Feb 19, 2026
@cuviper cuviper mentioned this pull request Feb 20, 2026
@cuviper cuviper modified the milestones: 1.95.0, 1.94.0 Feb 20, 2026
@cuviper cuviper removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Feb 20, 2026
rust-bors bot pushed a commit that referenced this pull request Feb 20, 2026
[beta] backports

- Consider captures to be used by closures that unwind #152103
- Fix feature gating for new `try bikeshed` expressions #152519
- reject inline const patterns pre-expansion #152548
- layout_of unexpected rigid alias delayed bug #152575
- resolve: Disable an assert that no longer holds #152711

r? cuviper
rust-bors bot pushed a commit that referenced this pull request Feb 20, 2026
[beta] backports

- Consider captures to be used by closures that unwind #152103
- Fix feature gating for new `try bikeshed` expressions #152519
- reject inline const patterns pre-expansion #152548
- layout_of unexpected rigid alias delayed bug #152575
- resolve: Disable an assert that no longer holds #152711

r? cuviper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beta-accepted Accepted for backporting to the compiler in the beta channel. 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.

Inline const patterns are no longer pre-expansion gated

6 participants