]>
Commit | Line | Data |
---|---|---|
6a06907d | 1 | error: reference to packed field is unaligned |
5099ac24 | 2 | --> tests/ui/pin_project/packed.rs:5:1 |
6a06907d | 3 | | |
136023e0 XL |
4 | 5 | / pin_project! { //~ ERROR reference to packed field is unaligned |
5 | 6 | | #[repr(packed, C)] | |
6 | 7 | | struct Packed { | |
7 | 8 | | #[pin] | |
8 | 9 | | field: u16, | |
9 | 10 | | } | |
10 | 11 | | } | |
6a06907d XL |
11 | | |_^ |
12 | | | |
13 | note: the lint level is defined here | |
5099ac24 | 14 | --> tests/ui/pin_project/packed.rs:5:1 |
6a06907d | 15 | | |
136023e0 XL |
16 | 5 | / pin_project! { //~ ERROR reference to packed field is unaligned |
17 | 6 | | #[repr(packed, C)] | |
18 | 7 | | struct Packed { | |
19 | 8 | | #[pin] | |
20 | 9 | | field: u16, | |
21 | 10 | | } | |
22 | 11 | | } | |
6a06907d | 23 | | |_^ |
136023e0 XL |
24 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
25 | = note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523> | |
6a06907d | 26 | = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) |
5099ac24 | 27 | = 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) |
923072b8 | 28 | = note: this error originates in the macro `$crate::__pin_project_constant` (in Nightly builds, run with -Z macro-backtrace for more info) |
6a06907d | 29 | |
136023e0 | 30 | error: reference to packed field is unaligned |
5099ac24 | 31 | --> tests/ui/pin_project/packed.rs:13:1 |
6a06907d | 32 | | |
136023e0 XL |
33 | 13 | / pin_project! { //~ ERROR reference to packed field is unaligned |
34 | 14 | | #[repr(packed(2))] | |
35 | 15 | | struct PackedN { | |
36 | 16 | | #[pin] | |
37 | 17 | | field: u32, | |
38 | 18 | | } | |
39 | 19 | | } | |
6a06907d XL |
40 | | |_^ |
41 | | | |
42 | note: the lint level is defined here | |
5099ac24 | 43 | --> tests/ui/pin_project/packed.rs:13:1 |
6a06907d | 44 | | |
136023e0 XL |
45 | 13 | / pin_project! { //~ ERROR reference to packed field is unaligned |
46 | 14 | | #[repr(packed(2))] | |
47 | 15 | | struct PackedN { | |
48 | 16 | | #[pin] | |
49 | 17 | | field: u32, | |
50 | 18 | | } | |
51 | 19 | | } | |
6a06907d XL |
52 | | |_^ |
53 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
136023e0 XL |
54 | = note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523> |
55 | = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) | |
5099ac24 | 56 | = 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) |
923072b8 | 57 | = note: this error originates in the macro `$crate::__pin_project_constant` (in Nightly builds, run with -Z macro-backtrace for more info) |