-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Description
I just ran into a variation on the following problem: Suppose I have a data type
enum A { B, C}
and some code somewhere else like:
alt check foo {
A {...}
B {...}
}
This says "I know that foo can't be in variant C". But what if I add a new variant D to A? Perhaps I really should add a case to the alt for D (since foo could now be in variant D), but the compiler gives me zero help in this case.
I propose an attribute called no_omit (actually, I don't really care what it's called) to be used like:
enum A { B, C, #[no_omit] D}
which has the effect of generating a warning if any alt check expressions omit the case for D. (I'm not too opinionated about whether it should be a lint warning or an error, so long as there's some way to enable it.) I expect the attribute would be used temporarily, during development, and then removed once the refactor that introduces D is completed.