]> git.lizzy.rs Git - rust.git/blob - tests/ui/packed/issue-27060.stderr
make unaligned_reference a hard error
[rust.git] / tests / ui / packed / issue-27060.stderr
1 error[E0793]: reference to packed field is unaligned
2   --> $DIR/issue-27060.rs:15:13
3    |
4 LL |     let _ = &good.data;
5    |             ^^^^^^^^^^
6    |
7    = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
8    = 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)
9
10 error[E0793]: reference to packed field is unaligned
11   --> $DIR/issue-27060.rs:16:13
12    |
13 LL |     let _ = &good.data2[0];
14    |             ^^^^^^^^^^^^^^
15    |
16    = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
17    = 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)
18
19 error[E0793]: reference to packed field is unaligned
20   --> $DIR/issue-27060.rs:18:13
21    |
22 LL |     let _ = &good.data;
23    |             ^^^^^^^^^^
24    |
25    = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
26    = 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)
27
28 error[E0793]: reference to packed field is unaligned
29   --> $DIR/issue-27060.rs:19:13
30    |
31 LL |     let _ = &good.data2[0];
32    |             ^^^^^^^^^^^^^^
33    |
34    = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
35    = 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)
36
37 error: aborting due to 4 previous errors
38
39 For more information about this error, try `rustc --explain E0793`.