E0059#
Warning name: unaligned_byte_access
Unaligned byte access in bits pattern.
This warning is emitted when a bits pattern performs an unaligned byte access. Consider adjusting the layout or using bit-level fields to keep accesses aligned.
Erroneous example#
fn f(x: Bytes) -> Unit {
match x {
[0x12, u1be(_), 0x34, ..] => ()
_ => ()
}
}
Suggestion#
Pad to the next byte boundary:
fn f(x: Bytes) -> Unit {
match x {
[0x12, u1be(_), u7be(_), 0x34, ..] => ()
_ => ()
}
}