Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alexcrichton opened this issue Aug 29, 2013 · 4 comments
Closed

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

alexcrichton opened this issue Aug 29, 2013 · 4 comments

Comments

@alexcrichton
Copy link
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.

@alexcrichton
Copy link
Member Author

Nominating for the backwards-compatible milestone.

@catamorphism
Copy link
Contributor

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

@thestinger
Copy link
Contributor

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

@alexcrichton
Copy link
Member Author

I'm ok with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants