You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/ui/lint/unaligned_references.stderr
+21-11
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
error[E0793]: reference to packed field is unaligned
2
-
--> $DIR/unaligned_references.rs:25:13
2
+
--> $DIR/unaligned_references.rs:28:13
3
3
|
4
4
LL | &self.x;
5
5
| ^^^^^^^
@@ -9,7 +9,17 @@ LL | &self.x;
9
9
= 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)
10
10
11
11
error[E0793]: reference to packed field is unaligned
12
-
--> $DIR/unaligned_references.rs:34:17
12
+
--> $DIR/unaligned_references.rs:40:24
13
+
|
14
+
LL | println!("{:?}", &*foo.0);
15
+
| ^^^^^
16
+
|
17
+
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
18
+
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
19
+
= 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)
20
+
21
+
error[E0793]: reference to packed field is unaligned
22
+
--> $DIR/unaligned_references.rs:47:17
13
23
|
14
24
LL | let _ = &good.ptr;
15
25
| ^^^^^^^^^
@@ -19,7 +29,7 @@ LL | let _ = &good.ptr;
19
29
= 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)
20
30
21
31
error[E0793]: reference to packed field is unaligned
22
-
--> $DIR/unaligned_references.rs:35:17
32
+
--> $DIR/unaligned_references.rs:48:17
23
33
|
24
34
LL | let _ = &good.data;
25
35
| ^^^^^^^^^^
@@ -29,7 +39,7 @@ LL | let _ = &good.data;
29
39
= 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)
30
40
31
41
error[E0793]: reference to packed field is unaligned
32
-
--> $DIR/unaligned_references.rs:37:17
42
+
--> $DIR/unaligned_references.rs:50:17
33
43
|
34
44
LL | let _ = &good.data as *const _;
35
45
| ^^^^^^^^^^
@@ -39,7 +49,7 @@ LL | let _ = &good.data as *const _;
39
49
= 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)
40
50
41
51
error[E0793]: reference to packed field is unaligned
= 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)
50
60
51
61
error[E0793]: reference to packed field is unaligned
52
-
--> $DIR/unaligned_references.rs:40:17
62
+
--> $DIR/unaligned_references.rs:53:17
53
63
|
54
64
LL | let _ = good.data.clone();
55
65
| ^^^^^^^^^
@@ -59,7 +69,7 @@ LL | let _ = good.data.clone();
59
69
= 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
70
61
71
error[E0793]: reference to packed field is unaligned
62
-
--> $DIR/unaligned_references.rs:42:17
72
+
--> $DIR/unaligned_references.rs:55:17
63
73
|
64
74
LL | let _ = &good.data2[0];
65
75
| ^^^^^^^^^^^^^^
@@ -69,7 +79,7 @@ LL | let _ = &good.data2[0];
69
79
= 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)
70
80
71
81
error[E0793]: reference to packed field is unaligned
72
-
--> $DIR/unaligned_references.rs:51:17
82
+
--> $DIR/unaligned_references.rs:64:17
73
83
|
74
84
LL | let _ = &packed2.x;
75
85
| ^^^^^^^^^^
@@ -79,7 +89,7 @@ LL | let _ = &packed2.x;
79
89
= 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)
80
90
81
91
error[E0793]: reference to packed field is unaligned
82
-
--> $DIR/unaligned_references.rs:90:20
92
+
--> $DIR/unaligned_references.rs:103:20
83
93
|
84
94
LL | let _ref = &m1.1.a;
85
95
| ^^^^^^^
@@ -89,7 +99,7 @@ LL | let _ref = &m1.1.a;
89
99
= 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)
90
100
91
101
error[E0793]: reference to packed field is unaligned
92
-
--> $DIR/unaligned_references.rs:93:20
102
+
--> $DIR/unaligned_references.rs:106:20
93
103
|
94
104
LL | let _ref = &m2.1.a;
95
105
| ^^^^^^^
@@ -98,6 +108,6 @@ LL | let _ref = &m2.1.a;
98
108
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
99
109
= 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)
100
110
101
-
error: aborting due to 10 previous errors
111
+
error: aborting due to 11 previous errors
102
112
103
113
For more information about this error, try `rustc --explain E0793`.
0 commit comments