summaryrefslogtreecommitdiffstats
path: root/tests/ui/lint/unaligned_references.stderr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /tests/ui/lint/unaligned_references.stderr
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/lint/unaligned_references.stderr')
-rw-r--r--tests/ui/lint/unaligned_references.stderr52
1 files changed, 41 insertions, 11 deletions
diff --git a/tests/ui/lint/unaligned_references.stderr b/tests/ui/lint/unaligned_references.stderr
index d3abc3766..328cafbd9 100644
--- a/tests/ui/lint/unaligned_references.stderr
+++ b/tests/ui/lint/unaligned_references.stderr
@@ -1,5 +1,5 @@
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:25:13
+ --> $DIR/unaligned_references.rs:28:13
|
LL | &self.x;
| ^^^^^^^
@@ -9,7 +9,37 @@ LL | &self.x;
= 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)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:34:17
+ --> $DIR/unaligned_references.rs:40:24
+ |
+LL | println!("{:?}", &*foo.0);
+ | ^^^^^
+ |
+ = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
+ = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
+ = 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)
+
+error[E0793]: reference to packed field is unaligned
+ --> $DIR/unaligned_references.rs:42:24
+ |
+LL | println!("{:?}", &*foo.0);
+ | ^^^^^
+ |
+ = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
+ = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
+ = 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)
+
+error[E0793]: reference to packed field is unaligned
+ --> $DIR/unaligned_references.rs:47:24
+ |
+LL | println!("{:?}", &*foo.0);
+ | ^^^^^
+ |
+ = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
+ = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
+ = 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)
+
+error[E0793]: reference to packed field is unaligned
+ --> $DIR/unaligned_references.rs:57:17
|
LL | let _ = &good.ptr;
| ^^^^^^^^^
@@ -19,7 +49,7 @@ LL | let _ = &good.ptr;
= 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)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:35:17
+ --> $DIR/unaligned_references.rs:58:17
|
LL | let _ = &good.data;
| ^^^^^^^^^^
@@ -29,7 +59,7 @@ LL | let _ = &good.data;
= 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)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:37:17
+ --> $DIR/unaligned_references.rs:60:17
|
LL | let _ = &good.data as *const _;
| ^^^^^^^^^^
@@ -39,7 +69,7 @@ LL | let _ = &good.data as *const _;
= 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)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:38:27
+ --> $DIR/unaligned_references.rs:61:27
|
LL | let _: *const _ = &good.data;
| ^^^^^^^^^^
@@ -49,7 +79,7 @@ LL | let _: *const _ = &good.data;
= 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)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:40:17
+ --> $DIR/unaligned_references.rs:63:17
|
LL | let _ = good.data.clone();
| ^^^^^^^^^
@@ -59,7 +89,7 @@ LL | let _ = good.data.clone();
= 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)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:42:17
+ --> $DIR/unaligned_references.rs:65:17
|
LL | let _ = &good.data2[0];
| ^^^^^^^^^^^^^^
@@ -69,7 +99,7 @@ LL | let _ = &good.data2[0];
= 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)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:51:17
+ --> $DIR/unaligned_references.rs:74:17
|
LL | let _ = &packed2.x;
| ^^^^^^^^^^
@@ -79,7 +109,7 @@ LL | let _ = &packed2.x;
= 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)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:90:20
+ --> $DIR/unaligned_references.rs:113:20
|
LL | let _ref = &m1.1.a;
| ^^^^^^^
@@ -89,7 +119,7 @@ LL | let _ref = &m1.1.a;
= 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)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:93:20
+ --> $DIR/unaligned_references.rs:116:20
|
LL | let _ref = &m2.1.a;
| ^^^^^^^
@@ -98,6 +128,6 @@ LL | let _ref = &m2.1.a;
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
= 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)
-error: aborting due to 10 previous errors
+error: aborting due to 13 previous errors
For more information about this error, try `rustc --explain E0793`.