-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
E0005; should all constructors be listed? #56379
Comments
Maybe we could do that with an upper bound, as having more than ~3 listed ranges will get really noisy. Imagine if you had a check for every other integer in u16, you'd have 32K ranges! I'd be fine with it as long as this is handled gracefully. It'll also be nice to mention when a range between two values involves |
@estebank Yeah an upper bound makes sense. |
Yeah, this was a case I was thinking about too — it'll probably be fairly common case, so it'd be good to handle sensibly. Edit: I've filed #56393 for this specific suggestion. |
@Centril is there still work left to do on this front? |
The match algorithm still short-circuits and reports only the first unencountered constructor in some cases. You can see this in some of the test cases for #65160, for instance. |
Couldn't find an example with missing integer ranges like the one mentioned in the OP; I suspect we've fixed those. Here's a different one (play): enum Foo {
A(bool),
B(bool),
C(bool),
}
fn main() {
match Foo::A(true) {
Foo::A(true) => {},
Foo::B(true) => {},
Foo::C(true) => {},
}
} This only errors about I'm adding my favorite label so I can find this later. |
See #56362 (comment) for context.
cc @estebank @petrochenkov @varkor
The text was updated successfully, but these errors were encountered: