Skip to content

Nullary enum variants shouldn't be able to be matched/declared with trailing parens () #12560

Closed
@huonw

Description

@huonw
enum Foo { Bar(), Baz() }
fn main() {
    println!("{}", match Bar { Bar() => 1, Baz() => 2 })
}

prints 1.

This seems a little peculiar: I would certainly prefer that they match unit structs and require that they don't have the ().

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-grammarArea: The grammar of RustE-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions