-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Closed
Labels
A-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTA-patternsRelating to patterns and pattern matchingRelating to patterns and pattern matchingC-bugCategory: This is a bug.Category: This is a bug.P-criticalCritical priorityCritical priorityS-has-bisectionStatus: A bisection has been found for this issueStatus: A bisection has been found for this issueS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.
Milestone
Description
Found while running fmease/rasur against the UI test suite (that's part of why I've written this parser in the first place, nice!).
Example reproducers:
These two programs now get accepted on beta and nightly even though they should continue to be rejected.
macro_rules! analyze { ($p:pat) => {}; }
analyze!(const { 0 });#[cfg(false)]
fn scope() { let const { 0 }; }Inline const patterns (a removed feature) are suddenly syntactically valid / accepted pre expansion. That's not right. For context, below are the errors that stable emits:
error: const blocks cannot be used as patterns
--> file.rs:4:16
|
4 | analyze!(const { 0 });
| ^^^^^
|
= help: use a named `const`-item or an `if`-guard (`x if x == const { ... }`) instead
error: const blocks cannot be used as patterns
--> file.rs:2:24
|
2 | fn scope() { let const { 0 }; }
| ^^^^^
|
= help: use a named `const`-item or an `if`-guard (`x if x == const { ... }`) instead
They're now parsed as "Pat(Expr(ConstBlock(AnonConst(..))))" (with mgca_disambiguation AnonConst) whereas before they were rejected+recovered as "Pat(Expr(Err(ErrorGuaranteed)))".
The bisection points to nightly-2025-12-30. Right, the correctness regression happened in PR #149667.
rustc 1.94.0-beta.2 (23a44d3c7 2026-01-25)
binary: rustc
commit-hash: 23a44d3c70448c08dc6a2fc13c1afceab49f2bb9
commit-date: 2026-01-25
host: x86_64-unknown-linux-gnu
release: 1.94.0-beta.2
LLVM version: 21.1.8
rustc 1.95.0-nightly (6efa357bf 2026-02-08)
binary: rustc
commit-hash: 6efa357bff60d192688e02de0c78cae24a7f3a55
commit-date: 2026-02-08
host: x86_64-unknown-linux-gnu
release: 1.95.0-nightly
LLVM version: 22.1.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTA-patternsRelating to patterns and pattern matchingRelating to patterns and pattern matchingC-bugCategory: This is a bug.Category: This is a bug.P-criticalCritical priorityCritical priorityS-has-bisectionStatus: A bisection has been found for this issueStatus: A bisection has been found for this issueS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.