reference
reference copied to clipboard
docs: add comprehensive documentation for borrowing from repr(packed)…
Document borrowing rules for repr(packed) fields (E0793).
This documents the behavior implemented in rust-lang/rust#145419:
- Disallow borrowing when the target’s ABI alignment exceeds the packed alignment (hard error E0793).
- Allow borrowing when ABI alignment is ≤ the packed alignment.
- For
[T; N]/[T], alignment equals that ofT, independent ofN.
Includes examples for the allowed [u8; N] case and the disallowed [u16; N] case.