]> git.lizzy.rs Git - rust.git/blob - tests/ui/lint/unaligned_references_external_macro.stderr
Rollup merge of #103702 - WaffleLapkin:lift-sized-bounds-from-pointer-methods-where...
[rust.git] / tests / 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    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
14    = note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
15    = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
16    = 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)
17 note: the lint level is defined here
18   --> $DIR/unaligned_references_external_macro.rs:5:1
19    |
20 LL | / unaligned_references_external_crate::mac! {
21 LL | |
22 LL | |     #[repr(packed)]
23 LL | |     pub struct X {
24 LL | |         pub field: u16
25 LL | |     }
26 LL | | }
27    | |_^
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    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
46    = note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
47    = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
48    = 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)
49 note: the lint level is defined here
50   --> $DIR/unaligned_references_external_macro.rs:5:1
51    |
52 LL | / unaligned_references_external_crate::mac! {
53 LL | |
54 LL | |     #[repr(packed)]
55 LL | |     pub struct X {
56 LL | |         pub field: u16
57 LL | |     }
58 LL | | }
59    | |_^
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