|
| 1 | +error[E0793]: reference to packed field is unaligned |
| 2 | + --> $DIR/unaligned_references.rs:32:13 |
| 3 | + | |
| 4 | +LL | &self.x; |
| 5 | + | ^^^^^^^ |
| 6 | + | |
| 7 | + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses |
| 8 | + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) |
| 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 | + |
| 11 | +error[E0793]: reference to packed field is unaligned |
| 12 | + --> $DIR/unaligned_references.rs:44: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:46:24 |
| 23 | + | |
| 24 | +LL | println!("{:?}", &*foo.0); |
| 25 | + | ^^^^^ |
| 26 | + | |
| 27 | + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses |
| 28 | + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) |
| 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) |
| 30 | + |
| 31 | +error[E0793]: reference to packed field is unaligned |
| 32 | + --> $DIR/unaligned_references.rs:51:24 |
| 33 | + | |
| 34 | +LL | println!("{:?}", &*foo.0); |
| 35 | + | ^^^^^ |
| 36 | + | |
| 37 | + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses |
| 38 | + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) |
| 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) |
| 40 | + |
| 41 | +error[E0793]: reference to packed field is unaligned |
| 42 | + --> $DIR/unaligned_references.rs:81:17 |
| 43 | + | |
| 44 | +LL | let _ = &good.ptr; |
| 45 | + | ^^^^^^^^^ |
| 46 | + | |
| 47 | + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses |
| 48 | + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) |
| 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) |
| 50 | + |
| 51 | +error[E0793]: reference to packed field is unaligned |
| 52 | + --> $DIR/unaligned_references.rs:82:17 |
| 53 | + | |
| 54 | +LL | let _ = &good.data; |
| 55 | + | ^^^^^^^^^^ |
| 56 | + | |
| 57 | + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses |
| 58 | + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) |
| 59 | + = 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 | + |
| 61 | +error[E0793]: reference to packed field is unaligned |
| 62 | + --> $DIR/unaligned_references.rs:84:17 |
| 63 | + | |
| 64 | +LL | let _ = &good.data as *const _; |
| 65 | + | ^^^^^^^^^^ |
| 66 | + | |
| 67 | + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses |
| 68 | + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) |
| 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) |
| 70 | + |
| 71 | +error[E0793]: reference to packed field is unaligned |
| 72 | + --> $DIR/unaligned_references.rs:85:27 |
| 73 | + | |
| 74 | +LL | let _: *const _ = &good.data; |
| 75 | + | ^^^^^^^^^^ |
| 76 | + | |
| 77 | + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses |
| 78 | + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) |
| 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) |
| 80 | + |
| 81 | +error[E0793]: reference to packed field is unaligned |
| 82 | + --> $DIR/unaligned_references.rs:87:17 |
| 83 | + | |
| 84 | +LL | let _ = good.data.clone(); |
| 85 | + | ^^^^^^^^^ |
| 86 | + | |
| 87 | + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses |
| 88 | + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) |
| 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) |
| 90 | + |
| 91 | +error[E0793]: reference to packed field is unaligned |
| 92 | + --> $DIR/unaligned_references.rs:89:17 |
| 93 | + | |
| 94 | +LL | let _ = &good.data2[0]; |
| 95 | + | ^^^^^^^^^^^^^^ |
| 96 | + | |
| 97 | + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses |
| 98 | + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) |
| 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) |
| 100 | + |
| 101 | +error[E0793]: reference to packed field is unaligned |
| 102 | + --> $DIR/unaligned_references.rs:98:17 |
| 103 | + | |
| 104 | +LL | let _ = &packed2.x; |
| 105 | + | ^^^^^^^^^^ |
| 106 | + | |
| 107 | + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses |
| 108 | + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) |
| 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) |
| 110 | + |
| 111 | +error[E0793]: reference to packed field is unaligned |
| 112 | + --> $DIR/unaligned_references.rs:137:20 |
| 113 | + | |
| 114 | +LL | let _ref = &m1.1.a; |
| 115 | + | ^^^^^^^ |
| 116 | + | |
| 117 | + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses |
| 118 | + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) |
| 119 | + = 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) |
| 120 | + |
| 121 | +error[E0793]: reference to packed field is unaligned |
| 122 | + --> $DIR/unaligned_references.rs:140:20 |
| 123 | + | |
| 124 | +LL | let _ref = &m2.1.a; |
| 125 | + | ^^^^^^^ |
| 126 | + | |
| 127 | + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses |
| 128 | + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) |
| 129 | + = 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) |
| 130 | + |
| 131 | +error: aborting due to 13 previous errors |
| 132 | + |
| 133 | +For more information about this error, try `rustc --explain E0793`. |
0 commit comments