]> git.lizzy.rs Git - rust.git/blob - tests/ui/binding/issue-53114-safety-checks.stderr
make unaligned_reference a hard error
[rust.git] / tests / ui / binding / issue-53114-safety-checks.stderr
1 error[E0793]: reference to packed field is unaligned
2   --> $DIR/issue-53114-safety-checks.rs:23:13
3    |
4 LL |     let _ = &p.b;
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-53114-safety-checks.rs:28:17
12    |
13 LL |     let (_,) = (&p.b,);
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-53114-safety-checks.rs:37:11
21    |
22 LL |     match &p.b  { _ => { } }
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-53114-safety-checks.rs:42:12
30    |
31 LL |     match (&p.b,)  { (_,) => { } }
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[E0133]: access to union field is unsafe and requires unsafe function or block
38   --> $DIR/issue-53114-safety-checks.rs:25:13
39    |
40 LL |     let _ = &u2.a;
41    |             ^^^^^ access to union field
42    |
43    = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
44
45 error[E0133]: access to union field is unsafe and requires unsafe function or block
46   --> $DIR/issue-53114-safety-checks.rs:29:17
47    |
48 LL |     let (_,) = (u1.a,);
49    |                 ^^^^ access to union field
50    |
51    = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
52
53 error[E0133]: access to union field is unsafe and requires unsafe function or block
54   --> $DIR/issue-53114-safety-checks.rs:30:17
55    |
56 LL |     let (_,) = (&u2.a,);
57    |                 ^^^^^ access to union field
58    |
59    = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
60
61 error[E0133]: access to union field is unsafe and requires unsafe function or block
62   --> $DIR/issue-53114-safety-checks.rs:38:11
63    |
64 LL |     match u1.a  { _ => { } }
65    |           ^^^^ access to union field
66    |
67    = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
68
69 error[E0133]: access to union field is unsafe and requires unsafe function or block
70   --> $DIR/issue-53114-safety-checks.rs:39:11
71    |
72 LL |     match &u2.a { _ => { } }
73    |           ^^^^^ access to union field
74    |
75    = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
76
77 error[E0133]: access to union field is unsafe and requires unsafe function or block
78   --> $DIR/issue-53114-safety-checks.rs:43:12
79    |
80 LL |     match (u1.a,)  { (_,) => { } }
81    |            ^^^^ access to union field
82    |
83    = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
84
85 error[E0133]: access to union field is unsafe and requires unsafe function or block
86   --> $DIR/issue-53114-safety-checks.rs:44:12
87    |
88 LL |     match (&u2.a,) { (_,) => { } }
89    |            ^^^^^ access to union field
90    |
91    = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
92
93 error: aborting due to 11 previous errors
94
95 Some errors have detailed explanations: E0133, E0793.
96 For more information about an error, try `rustc --explain E0133`.