Skip to content

Improving an error message: "cannot bind by-move into a pattern guard" #4649

Closed
@catamorphism

Description

@catamorphism

Based on an IRC conversation just now, I can think of two ways to improve this error message:

  1. Because pattern guards use the "if" keyword, someone may have written one by accident. Then, if they see this error message, they're going to ask "what's a pattern guard"? The error could explain this (it's a little hard to figure out right now since the entire pattern gets underlined, not the guard).
  2. Probably more importantly, the error should suggest what to do to fix it.

The error in question is in rustc::middle::check_match.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsO-windowsOperating system: Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions