Repository navigation
E0005; should all constructors be listed? #56379
Description
Activity
- addedA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
on Nov 30, 2018 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
std::{integer}::MAXorMIN.Reacted by varkor and Mazdak Farrokhzad@estebank Yeah an upper bound makes sense.
It'll also be nice to mention when a range between two values involves std::{integer}::MAX or MIN.
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.
Reacted by Esteban Kuber- addedC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.
on Jun 11, 2020 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
A(false)not being covered.I'm adding my favorite label so I can find this later.
@rustbot modify labels: +A-exhaustiveness-checkingReacted by Esteban Kuber- addedA-exhaustiveness-checkingRelating to exhaustiveness / usefulness checking of patternsRelating to exhaustiveness / usefulness checking of patterns
on Nov 22, 2020
See #56362 (comment) for context.
cc @estebank @petrochenkov @varkor