Skip to content

Improve diagnostic for patterns in function pointer types - #160282

Open
JonathanBrouwer wants to merge 2 commits into
rust-lang:mainfrom
JonathanBrouwer:arg-pattern
Open

Improve diagnostic for patterns in function pointer types#160282
JonathanBrouwer wants to merge 2 commits into
rust-lang:mainfrom
JonathanBrouwer:arg-pattern

Conversation

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

In preparation for some work for #158499

Diagnostic before:

error[E0642]: patterns aren't allowed in methods without bodies
  --> $DIR/fn-ptr-pattern.rs:4:14
   |
LL |     pat2: fn(1..3: bool),
   |              ^^^^
   |
help: give this argument a name or use an underscore to ignore it
   |
LL -     pat2: fn(1..3: bool),
LL +     pat2: fn(_: bool),
   |

Diagnostic after:

error[E0642]: patterns aren't allowed in function pointer types
  --> $DIR/fn-ptr-pattern.rs:4:14
   |
LL |     pat2: fn(1..3: bool),
   |              ^^^^
   |
help: give this argument a name or use an underscore to ignore it
   |
LL -     pat2: fn(1..3: bool),
LL +     pat2: fn(_: bool),
   |

@rustbot

rustbot commented Jul 31, 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 Jul 31, 2026
@rustbot

rustbot commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

r? @petrochenkov

rustbot has assigned @petrochenkov.
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 17 candidates

@JonathanBrouwer JonathanBrouwer added the A-diagnostics Area: Messages for errors, warnings, and lints label Jul 31, 2026
@petrochenkov

Copy link
Copy Markdown
Contributor

@bors r+

@rust-bors

rust-bors Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

📌 Commit c1bcbb4 has been approved by petrochenkov

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 Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-diagnostics Area: Messages for errors, warnings, and lints 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.

3 participants