Deriving NoUninit
(and therefore Pod
) without repr(packed)
by asserting all fields have the same alignment
#263
Labels
proc-macros
I don't do proc-macros, but I accepts PRs about them.
An asserting const within a trait impl will trigger a late-monomorphization error. This can be used to directly check for uninit bytes.
This should be opt-in in the derive trait. For manual implementations a helper macro could provide the same field checks.
Please note that this implementation is was written in a couple of minutes, so it may have unforeseen issues.
Example: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=8d97b800a96d2becd5d7b75fa52fb3fe
The text was updated successfully, but these errors were encountered: