Document why we don't require a repr for an enum to be FromZeroes
#146
Labels
compatibility-nonbreaking
Changes that are (likely to be) non-breaking
Uh oh!
There was an error while loading. Please reload this page.
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 explicitrepr
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 theFromZeroes
docs like we do for not requiring a repr for that trait (or forFromBytes
).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
The text was updated successfully, but these errors were encountered: