Skip to content

Reduce jargon in "refutable pattern in local binding" diagnostic #58385

Closed
@estebank

Description

@estebank

Although the following error is not incorrect, it is unnecessarily obtuse for newcomers:

error[E0005]: refutable pattern in local binding: `T(_, _)` not covered
  --> $DIR/empty-never-array.rs:10:9
   |
LL |     let Helper::U(u) = Helper::T(t, []);
   |         ^^^^^^^^^^^^ pattern `T(_, _)` not covered

error: aborting due to previous error

We should probably reword the error to have a better explanation of what is happening in terms that someone just starting in the language can understand it along the lines "Hey! You are trying to destructure (even more jargon) an enum variant, but you aren't handling other possible enum variants. You might have meant to use if let."

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions