rust/tests/ui/lint/unaligned_references.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

134 lines
8.1 KiB
Plaintext
Raw Normal View History

2022-09-30 12:54:30 +00:00
error[E0793]: reference to packed field is unaligned
--> $DIR/unaligned_references.rs:28:13
2023-02-16 17:17:55 +00:00
|
LL | &self.x;
| ^^^^^^^
|
= 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)
2023-02-16 17:17:55 +00:00
= 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: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
2020-05-25 13:32:46 +00:00
|
2020-05-27 18:31:17 +00:00
LL | let _ = &good.ptr;
| ^^^^^^^^^
2020-05-25 13:32:46 +00:00
|
= 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)
2022-09-18 15:55:36 +00:00
= 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)
2020-05-25 13:32:46 +00:00
2022-09-30 12:54:30 +00:00
error[E0793]: reference to packed field is unaligned
--> $DIR/unaligned_references.rs:58:17
2020-05-27 18:31:17 +00:00
|
LL | let _ = &good.data;
| ^^^^^^^^^^
|
= 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)
2020-05-27 18:31:17 +00:00
2022-09-30 12:54:30 +00:00
error[E0793]: reference to packed field is unaligned
--> $DIR/unaligned_references.rs:60:17
2020-05-25 13:32:46 +00:00
|
LL | let _ = &good.data as *const _;
| ^^^^^^^^^^
|
= 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)
2020-05-25 13:32:46 +00:00
2022-09-30 12:54:30 +00:00
error[E0793]: reference to packed field is unaligned
--> $DIR/unaligned_references.rs:61:27
2020-05-25 13:32:46 +00:00
|
LL | let _: *const _ = &good.data;
| ^^^^^^^^^^
|
= 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)
2020-05-25 13:32:46 +00:00
2022-09-30 12:54:30 +00:00
error[E0793]: reference to packed field is unaligned
--> $DIR/unaligned_references.rs:63:17
2020-05-27 18:31:17 +00:00
|
LL | let _ = good.data.clone();
| ^^^^^^^^^
2020-05-27 18:31:17 +00:00
|
= 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)
2020-05-27 18:31:17 +00:00
2022-09-30 12:54:30 +00:00
error[E0793]: reference to packed field is unaligned
--> $DIR/unaligned_references.rs:65:17
2020-05-25 13:32:46 +00:00
|
LL | let _ = &good.data2[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)
2020-05-25 13:32:46 +00:00
2022-09-30 12:54:30 +00:00
error[E0793]: reference to packed field is unaligned
--> $DIR/unaligned_references.rs:74:17
|
LL | let _ = &packed2.x;
| ^^^^^^^^^^
|
= 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)
2022-09-30 12:54:30 +00:00
error[E0793]: reference to packed field is unaligned
--> $DIR/unaligned_references.rs:113:20
|
LL | let _ref = &m1.1.a;
| ^^^^^^^
|
= 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)
2022-09-30 12:54:30 +00:00
error[E0793]: reference to packed field is unaligned
--> $DIR/unaligned_references.rs:116:20
|
LL | let _ref = &m2.1.a;
| ^^^^^^^
|
= 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: aborting due to 13 previous errors
2020-05-25 13:32:46 +00:00
2022-09-30 12:54:30 +00:00
For more information about this error, try `rustc --explain E0793`.