mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
94 lines
5.6 KiB
Plaintext
94 lines
5.6 KiB
Plaintext
error[E0793]: reference to packed field is unaligned
|
|
--> $DIR/unaligned_references.rs:25:13
|
|
|
|
|
LL | &self.x;
|
|
| ^^^^^^^
|
|
|
|
|
= note: fields of packed structs are not properly aligned, and 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:34:17
|
|
|
|
|
LL | let _ = &good.ptr;
|
|
| ^^^^^^^^^
|
|
|
|
|
= note: fields of packed structs are not properly aligned, and 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:35:17
|
|
|
|
|
LL | let _ = &good.data;
|
|
| ^^^^^^^^^^
|
|
|
|
|
= note: fields of packed structs are not properly aligned, and 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:37:17
|
|
|
|
|
LL | let _ = &good.data as *const _;
|
|
| ^^^^^^^^^^
|
|
|
|
|
= note: fields of packed structs are not properly aligned, and 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:38:27
|
|
|
|
|
LL | let _: *const _ = &good.data;
|
|
| ^^^^^^^^^^
|
|
|
|
|
= note: fields of packed structs are not properly aligned, and 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:40:17
|
|
|
|
|
LL | let _ = good.data.clone();
|
|
| ^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: fields of packed structs are not properly aligned, and 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:17
|
|
|
|
|
LL | let _ = &good.data2[0];
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
= note: fields of packed structs are not properly aligned, and 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:51:17
|
|
|
|
|
LL | let _ = &packed2.x;
|
|
| ^^^^^^^^^^
|
|
|
|
|
= note: fields of packed structs are not properly aligned, and 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:90:20
|
|
|
|
|
LL | let _ref = &m1.1.a;
|
|
| ^^^^^^^
|
|
|
|
|
= note: fields of packed structs are not properly aligned, and 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:93:20
|
|
|
|
|
LL | let _ref = &m2.1.a;
|
|
| ^^^^^^^
|
|
|
|
|
= note: fields of packed structs are not properly aligned, and 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
|
|
|
|
For more information about this error, try `rustc --explain E0793`.
|