Skip to content

Enums with no values can be matched with (*) #8837

Closed
@alexcrichton

Description

@alexcrichton
Member

The following code compiles just fine, but I don't think that it should

enum A { B }

fn main() {
    match B {
        B(*) => {}
    }
}

Is that actually valid syntax? I would expect to get a compiler error that you can't ignore all fields when there are none to begin with.

Activity

alexcrichton

alexcrichton commented on Sep 16, 2013

@alexcrichton
MemberAuthor

Nominating for the backwards-compatible milestone.

catamorphism

catamorphism commented on Sep 16, 2013

@catamorphism
Contributor

Is this a bug? "Ignore all fields" is trivially true when there are zero fields.

thestinger

thestinger commented on Sep 16, 2013

@thestinger
Contributor

I think this should be allowed, but see #5830 about the general inconsistency with these.

alexcrichton

alexcrichton commented on Sep 16, 2013

@alexcrichton
MemberAuthor

I'm ok with that.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @alexcrichton@catamorphism@thestinger

        Issue actions

          Enums with no values can be matched with (*) · Issue #8837 · rust-lang/rust