Error code E0793
An unaligned reference to a field of a packed struct got created.
Erroneous code example:
ⓘ
Creating a reference to an insufficiently aligned packed field is
undefined behavior and therefore disallowed. Using an unsafe
block does not
change anything about this. Instead, the code should do a copy of the data in
the packed field or use raw pointers and unaligned accesses.
Additional information
Note that this error is specifically about references to packed fields. Direct by-value access of those fields is fine, since then the compiler has enough information to generate the correct kind of access.
See issue #82523 for more information.