]> git.lizzy.rs Git - rust.git/blob - src/test/ui/lint/unaligned_references_external_macro.stderr
merge rustc history
[rust.git] / src / test / ui / lint / unaligned_references_external_macro.stderr
1 error: reference to packed field is unaligned
2   --> $DIR/unaligned_references_external_macro.rs:5:1
3    |
4 LL | / unaligned_references_external_crate::mac! {
5 LL | |
6 LL | |     #[repr(packed)]
7 LL | |     pub struct X {
8 LL | |         pub field: u16
9 LL | |     }
10 LL | | }
11    | |_^
12    |
13 note: the lint level is defined here
14   --> $DIR/unaligned_references_external_macro.rs:5:1
15    |
16 LL | / unaligned_references_external_crate::mac! {
17 LL | |
18 LL | |     #[repr(packed)]
19 LL | |     pub struct X {
20 LL | |         pub field: u16
21 LL | |     }
22 LL | | }
23    | |_^
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>
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)
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)
28    = note: this error originates in the macro `unaligned_references_external_crate::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
29
30 error: aborting due to previous error
31
32 Future incompatibility report: Future breakage diagnostic:
33 error: reference to packed field is unaligned
34   --> $DIR/unaligned_references_external_macro.rs:5:1
35    |
36 LL | / unaligned_references_external_crate::mac! {
37 LL | |
38 LL | |     #[repr(packed)]
39 LL | |     pub struct X {
40 LL | |         pub field: u16
41 LL | |     }
42 LL | | }
43    | |_^
44    |
45 note: the lint level is defined here
46   --> $DIR/unaligned_references_external_macro.rs:5:1
47    |
48 LL | / unaligned_references_external_crate::mac! {
49 LL | |
50 LL | |     #[repr(packed)]
51 LL | |     pub struct X {
52 LL | |         pub field: u16
53 LL | |     }
54 LL | | }
55    | |_^
56    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
57    = note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
58    = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
59    = 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)
60    = note: this error originates in the macro `unaligned_references_external_crate::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
61