Skip to content

Unify errors for Unit pattern on Tuple and Struct variants #63983

Closed
@djrenren

Description

@djrenren

Code Example (playground):

enum MyEnum {
    Tuple(i32),
    Struct { s: i32 },
}

fn foo(en: MyEnum) {
    match en {
        MyEnum::Tuple => "",
        MyEnum::Struct => "",
    };
}

image

Currently we provide a "do you mean..." for the Struct but not for the Tuple. We probably should provide one for both.

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`C-enhancementCategory: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.P-lowLow priorityT-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