rust/tests/ui/lint/unaligned_references.stderr

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

104 lines
6.3 KiB
Plaintext
Raw Normal View History

2022-09-30 07:54:30 -05:00
error[E0793]: reference to packed field is unaligned
2023-02-16 11:17:55 -06:00
--> $DIR/unaligned_references.rs:25:13
|
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 11:17:55 -06: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:34:17
2020-05-25 08:32:46 -05:00
|
2020-05-27 13:31:17 -05:00
LL | let _ = &good.ptr;
| ^^^^^^^^^
2020-05-25 08:32:46 -05: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 10:55:36 -05: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 08:32:46 -05:00
2022-09-30 07:54:30 -05:00
error[E0793]: reference to packed field is unaligned
2023-02-16 11:17:55 -06:00
--> $DIR/unaligned_references.rs:35:17
2020-05-27 13:31:17 -05: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 13:31:17 -05:00
2022-09-30 07:54:30 -05:00
error[E0793]: reference to packed field is unaligned
2023-02-16 11:17:55 -06:00
--> $DIR/unaligned_references.rs:37:17
2020-05-25 08:32:46 -05: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 08:32:46 -05:00
2022-09-30 07:54:30 -05:00
error[E0793]: reference to packed field is unaligned
2023-02-16 11:17:55 -06:00
--> $DIR/unaligned_references.rs:38:27
2020-05-25 08:32:46 -05: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 08:32:46 -05:00
2022-09-30 07:54:30 -05:00
error[E0793]: reference to packed field is unaligned
2023-02-16 11:17:55 -06:00
--> $DIR/unaligned_references.rs:40:17
2020-05-27 13:31:17 -05:00
|
LL | let _ = good.data.clone();
2021-09-16 15:01:22 -05:00
| ^^^^^^^^^^^^^^^^^
2020-05-27 13:31:17 -05: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 13:31:17 -05:00
2022-09-30 07:54:30 -05:00
error[E0793]: reference to packed field is unaligned
2023-02-16 11:17:55 -06:00
--> $DIR/unaligned_references.rs:42:17
2020-05-25 08:32:46 -05: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 08:32:46 -05:00
2022-09-30 07:54:30 -05:00
error[E0793]: reference to packed field is unaligned
2023-02-16 11:17:55 -06:00
--> $DIR/unaligned_references.rs:51: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 07:54:30 -05:00
error[E0793]: reference to packed field is unaligned
2023-02-16 11:17:55 -06:00
--> $DIR/unaligned_references.rs:90: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 07:54:30 -05:00
error[E0793]: reference to packed field is unaligned
2023-02-16 11:17:55 -06:00
--> $DIR/unaligned_references.rs:93: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)
2023-02-16 11:17:55 -06:00
error: aborting due to 10 previous errors
2020-05-25 08:32:46 -05:00
2022-09-30 07:54:30 -05:00
For more information about this error, try `rustc --explain E0793`.