Skip to content

parser diagnostics: Suggest adding a body for a match arm followed by a comma - #160787

Open
jakubadamw wants to merge 1 commit into
rust-lang:mainfrom
jakubadamw:issue-159686
Open

parser diagnostics: Suggest adding a body for a match arm followed by a comma#160787
jakubadamw wants to merge 1 commit into
rust-lang:mainfrom
jakubadamw:issue-159686

Conversation

@jakubadamw

@jakubadamw jakubadamw commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

parser diagnostics: only suggest a tuple or an or-pattern when the comma-separated patterns are followed by a => or a guard. Otherwise the arm is just missing a body, which will then be reported by parse_arm.

No new tests, because existing tests cover this, I’ve extended with one more specific example and updated their expected results.

Closes #159686.

Only suggest a tuple or an or-pattern when the comma-separated patterns
are followed by a `=>` or a guard. Otherwise the arm is just missing a
body, which `parse_arm` already reports.
@rustbot

rustbot commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

The parser was modified, potentially altering the grammar of (stable) Rust
which would be a breaking change.

cc @fmease

@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 Aug 9, 2026
@rustbot

rustbot commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

r? @dingxiangfei2009

rustbot has assigned @dingxiangfei2009.
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 75 candidates
  • Random selection from 19 candidates

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

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing arm should recommend adding an arm

3 participants