Skip to content

misleading "try adding parentheses" in match with comma #54807

Description

@ChrisJefferson

Consider the following (incorrect) code.

enum E { A,B,C }

fn x(e:E) -> i32 {
    match e {
        A,B => 1,
        C => 2
    }
}

The comma in the match is obviously supposed to be a |. However, rustc recommends I rewrite to (A,B), which makes the situation worse, as the compile error becomes expected enum E, found tuple.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions