Skip to content

Suggest if-let chain continuation on unclosed delimiter - #160592

Open
Diacod-I wants to merge 1 commit into
rust-lang:mainfrom
Diacod-I:if-let-chain-unclosed-delim-hint
Open

Suggest if-let chain continuation on unclosed delimiter#160592
Diacod-I wants to merge 1 commit into
rust-lang:mainfrom
Diacod-I:if-let-chain-unclosed-delim-hint

Conversation

@Diacod-I

@Diacod-I Diacod-I commented Aug 5, 2026

Copy link
Copy Markdown

Meant to fix #160550. When an unclosed brace-delimited block begins with && or ||, the "unclosed delimiter" error now points at that line, suggesting the user may have meant to continue an if-let chain.

  • Records the leading &&/|| span during lexing (in lex_token_tree_open_delim) and surfaces it in report_suspicious_mismatch_block.
  • Adds a tests/ui/parser regression test.
  • I did not use an LLM to create a change in this PR.
  • I used an LLM to create a change in this PR, and I have explained below how it was used.

@rustbot

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

rustbot commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @JohnTitor (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue
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 18 candidates

@rustbot

This comment has been minimized.

@Diacod-I
Diacod-I force-pushed the if-let-chain-unclosed-delim-hint branch from 87cc2ee to 68e51b9 Compare August 5, 2026 20:54
@rust-log-analyzer

This comment has been minimized.

@Diacod-I
Diacod-I force-pushed the if-let-chain-unclosed-delim-hint branch from 68e51b9 to 39b3ad8 Compare August 6, 2026 01:52
@estebank

estebank commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

I seriously thought getting something working was going to be more complex than this ^_^'

We'd want to add some complexity later to better customize the message (there are some cases where this wasn't a let chain), but I'm ok with this for now.

@bors r+

@rust-bors

rust-bors Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 39b3ad8 has been approved by estebank

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 Aug 6, 2026
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.

Extra { in if let chain doesn't provide enough context

5 participants