-
Notifications
You must be signed in to change notification settings - Fork 142
Description
When deriving FromZeroes on an enum, and in the safety requirements in the doc comment for that trait, we don't require the enum to have an explicit repr attribute. The justification is that, regardless of repr, an enum's discriminant is well-defined according to the reference. We should document this justification in the FromZeroes docs like we do for not requiring a repr for that trait (or for FromBytes).
Is this actually sound?
Though I was initially convinced by this argument, I'm now second-guessing myself since, even if the discriminant's semantic value is well-defined without an explicit repr, it's less clear that the layout of an enum (ie, how its bits are used to represent that semantic value) is well-defined.
If it turns out that this is actually unsound, then of course we should change the behavior before releasing rather than documenting a justification for it.
cc @djkoloski