-
Notifications
You must be signed in to change notification settings - Fork 130
Closed
Description
The TryFromBytes derive for unions requires that Self: NoCell, due to the safety obligations of Ptr::project in its implementation of is_bit_valid. By contrast, the derives for FromZeros and FromBytes on unions do not require Self: NoCell.
We would like to make TryFromBytes a super-trait of FromZeros, but (as we discovered in #952) this mismatch in requirements presents us with a trilemma:
- don't make
TryFromBytesa super-trait ofFromZeros - find a way to remove the
NoCellrequirements on theTryFromBytesderive for unions - propagate the
NoCellrequirement on unions to the derives forFromZerosandFromBytes
Short-Term Resolution
We:
- don't formally make
TryFromBytesa super-trait ofFromZeros, but we document that this relationship may be required in the future - propagate the
NoCellrequirement on unions to the derives forFromZerosandFromBytes
Making FromZeros: TryFromBytes may create future breakage for customers manually implementing FromZeros, but this workflow is explicitly documented as unsupported.
Metadata
Metadata
Assignees
Labels
No labels