Closed
Description
The invalid_value
lint has no issue with the following type being zero-initialized or left uninit:
enum OneFruitNonzero {
Apple(!),
Banana(NonZeroU32),
}
That seems like a case we should be able to handle.
I think for non-is_multi_variant
enums, we probably can compute the variant that does exist, and then we can recursively check if that one is valid? We'd also need a smarter is_multi_variant
that can handle some dataful variants (ensuring they are definitely inhabited).
Cc @5225225
Activity
RalfJung commentedon Sep 25, 2022
Will be fixed by #102281
Rageking8 commentedon Sep 26, 2022
@rustbot label +C-bug +A-lint
Rollup merge of rust-lang#102281 - RalfJung:invalid-enums, r=cjgillot