give more help in the unaligned_references lint

This commit is contained in:
Ralf Jung 2021-12-09 12:45:00 -05:00
parent e250777041
commit 7d18a456ca
8 changed files with 25 additions and 0 deletions

View file

@ -105,6 +105,11 @@ impl<'tcx> Visitor<'tcx> for PackedRefChecker<'_, 'tcx> {
a misaligned reference is undefined behavior (even if that \
reference is never dereferenced)",
)
.help(
"copy the field contents to a local variable, or replace the \
reference with a raw pointer and use `read_unaligned`/`write_unaligned` \
(loads and stores via `*p` must be properly aligned even when using raw pointers)"
)
.emit()
},
);