| 1 |
error[E0080]: transmuting from 2-byte type to 1-byte type: `AU16` -> `u8` |
| 2 |
--> $DIR/late-compile-pass.rs:20:37 |
| 3 |
| |
| 4 |
20 | const TRANSMUTE_DECREASE_SIZE: u8 = transmute!(AU16(0)); |
| 5 |
| ^^^^^^^^^^^^^^^^^^^ evaluation of `TRANSMUTE_DECREASE_SIZE` failed here |
| 6 |
| |
| 7 |
= note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) |
| 8 |
|
| 9 |
error[E0080]: transmuting from 1-byte type to 2-byte type: `u8` -> `AU16` |
| 10 |
--> $DIR/late-compile-pass.rs:26:39 |
| 11 |
| |
| 12 |
26 | const TRANSMUTE_INCREASE_SIZE: AU16 = transmute!(0u8); |
| 13 |
| ^^^^^^^^^^^^^^^ evaluation of `TRANSMUTE_INCREASE_SIZE` failed here |
| 14 |
| |
| 15 |
= note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) |
| 16 |
|
| 17 |
error[E0080]: transmuting from 1-byte type to 2-byte type: `u8` -> `Transmute<u8, AU16>` |
| 18 |
--> $DIR/late-compile-pass.rs:32:52 |
| 19 |
| |
| 20 |
32 | const TRANSMUTE_INCREASE_SIZE_ALLOW_SHRINK: AU16 = transmute!(#![allow(shrink)] 0u8); |
| 21 |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `TRANSMUTE_INCREASE_SIZE_ALLOW_SHRINK` failed here |
| 22 |
| |
| 23 |
= note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) |
| 24 |
|
| 25 |
warning: taking a mutable reference to a `const` item |
| 26 |
--> $DIR/late-compile-pass.rs:39:66 |
| 27 |
| |
| 28 |
39 | const TRANSMUTE_MUT_CONST_CONTEXT: &mut [u8; 2] = transmute_mut!(&mut ARRAY_OF_U8S); |
| 29 |
| ^^^^^^^^^^^^^^^^^ |
| 30 |
| |
| 31 |
= note: each usage of a `const` item creates a new temporary |
| 32 |
= note: the mutable reference will refer to this temporary, not the original `const` item |
| 33 |
note: `const` item defined here |
| 34 |
--> $DIR/late-compile-pass.rs:36:1 |
| 35 |
| |
| 36 |
36 | const ARRAY_OF_U8S: [u8; 2] = [0u8; 2]; |
| 37 |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 38 |
= note: `#[warn(const_item_mutation)]` on by default |
| 39 |
|
| 40 |
error[E0015]: cannot call non-const method `zerocopy::util::macro_util::Wrap::<&mut [u8; 2], &mut [u8; 2]>::transmute_mut_inference_helper` in constants |
| 41 |
--> $DIR/late-compile-pass.rs:39:51 |
| 42 |
| |
| 43 |
39 | const TRANSMUTE_MUT_CONST_CONTEXT: &mut [u8; 2] = transmute_mut!(&mut ARRAY_OF_U8S); |
| 44 |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 45 |
| |
| 46 |
= note: calls in constants are limited to constant functions, tuple structs and tuple variants |
| 47 |
= note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) |
| 48 |
|
| 49 |
error[E0015]: cannot call non-const method `zerocopy::util::macro_util::Wrap::<&mut [u8; 2], &mut [u8; 2]>::transmute_mut` in constants |
| 50 |
--> $DIR/late-compile-pass.rs:39:51 |
| 51 |
| |
| 52 |
39 | const TRANSMUTE_MUT_CONST_CONTEXT: &mut [u8; 2] = transmute_mut!(&mut ARRAY_OF_U8S); |
| 53 |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 54 |
| |
| 55 |
= note: calls in constants are limited to constant functions, tuple structs and tuple variants |
| 56 |
= note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) |
| 57 |
|
| 58 |
error[E0080]: transmuting from 4-byte type to 8-byte type: `[u8; 4]` -> `u64` |
| 59 |
--> $DIR/late-compile-pass.rs:50:39 |
| 60 |
| |
| 61 |
50 | ...IZE: u64 = zerocopy::include_value!("../../testdata/include_value/data"); |
| 62 |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `INCLUDE_VALUE_WRONG_SIZE` failed here |
| 63 |
| |
| 64 |
= note: this error originates in the macro `$crate::transmute` which comes from the expansion of the macro `zerocopy::include_value` (in Nightly builds, run with -Z macro-backtrace for more info) |
| 65 |
|
| 66 |
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types |
| 67 |
--> $DIR/late-compile-pass.rs:20:37 |
| 68 |
| |
| 69 |
20 | const TRANSMUTE_DECREASE_SIZE: u8 = transmute!(AU16(0)); |
| 70 |
| ^^^^^^^^^^^^^^^^^^^ |
| 71 |
| |
| 72 |
= note: source type: `AU16` (16 bits) |
| 73 |
= note: target type: `u8` (8 bits) |
| 74 |
= note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) |
| 75 |
|
| 76 |
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types |
| 77 |
--> $DIR/late-compile-pass.rs:26:39 |
| 78 |
| |
| 79 |
26 | const TRANSMUTE_INCREASE_SIZE: AU16 = transmute!(0u8); |
| 80 |
| ^^^^^^^^^^^^^^^ |
| 81 |
| |
| 82 |
= note: source type: `u8` (8 bits) |
| 83 |
= note: target type: `AU16` (16 bits) |
| 84 |
= note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) |
| 85 |
|
| 86 |
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types |
| 87 |
--> $DIR/late-compile-pass.rs:32:52 |
| 88 |
| |
| 89 |
32 | const TRANSMUTE_INCREASE_SIZE_ALLOW_SHRINK: AU16 = transmute!(#![allow(shrink)] 0u8); |
| 90 |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 91 |
| |
| 92 |
= note: source type: `u8` (8 bits) |
| 93 |
= note: target type: `Transmute<u8, AU16>` (16 bits) |
| 94 |
= note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) |
| 95 |
|
| 96 |
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types |
| 97 |
--> $DIR/late-compile-pass.rs:50:39 |
| 98 |
| |
| 99 |
50 | ...G_SIZE: u64 = zerocopy::include_value!("../../testdata/include_value/data"); |
| 100 |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 101 |
| |
| 102 |
= note: source type: `[u8; 4]` (32 bits) |
| 103 |
= note: target type: `u64` (64 bits) |
| 104 |
= note: this error originates in the macro `$crate::transmute` which comes from the expansion of the macro `zerocopy::include_value` (in Nightly builds, run with -Z macro-backtrace for more info) |
| 105 |
|
| 106 |
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types |
| 107 |
--> $DIR/late-compile-pass.rs:58:41 |
| 108 |
| |
| 109 |
58 | let _decrease_size: Result<u8, _> = try_transmute!(AU16(0)); |
| 110 |
| ^^^^^^^^^^^^^^^^^^^^^^^ |
| 111 |
| |
| 112 |
= note: source type: `AU16` (16 bits) |
| 113 |
= note: target type: `u8` (8 bits) |
| 114 |
= note: this error originates in the macro `try_transmute` (in Nightly builds, run with -Z macro-backtrace for more info) |
| 115 |
|
| 116 |
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types |
| 117 |
--> $DIR/late-compile-pass.rs:63:43 |
| 118 |
| |
| 119 |
63 | let _increase_size: Result<AU16, _> = try_transmute!(0u8); |
| 120 |
| ^^^^^^^^^^^^^^^^^^^ |
| 121 |
| |
| 122 |
= note: source type: `u8` (8 bits) |
| 123 |
= note: target type: `AU16` (16 bits) |
| 124 |
= note: this error originates in the macro `try_transmute` (in Nightly builds, run with -Z macro-backtrace for more info) |
| 125 |
|
| 126 |
error[E0597]: `x` does not live long enough |
| 127 |
--> $DIR/late-compile-pass.rs:69:60 |
| 128 |
| |
| 129 |
67 | let mut x = 0u64; |
| 130 |
| ----- binding `x` declared here |
| 131 |
68 | // It is illegal to increase the lifetime scope. |
| 132 |
69 | let _: &'static mut u64 = zerocopy::transmute_mut!(&mut x); |
| 133 |
| ---------------- ^^^^^^ borrowed value does not live long enough |
| 134 |
| | |
| 135 |
| type annotation requires that `x` is borrowed for `'static` |
| 136 |
70 | |
| 137 |
71 | } |
| 138 |
| - `x` dropped here while still borrowed |
| 139 |
|
| 140 |
error[E0597]: `x` does not live long enough |
| 141 |
--> $DIR/late-compile-pass.rs:76:56 |
| 142 |
| |
| 143 |
74 | let x = 0u64; |
| 144 |
| - binding `x` declared here |
| 145 |
75 | // It is illegal to increase the lifetime scope. |
| 146 |
76 | let _: &'static u64 = zerocopy::transmute_ref!(&x); |
| 147 |
| ------------ ^^ borrowed value does not live long enough |
| 148 |
| | |
| 149 |
| type annotation requires that `x` is borrowed for `'static` |
| 150 |
77 | |
| 151 |
78 | } |
| 152 |
| - `x` dropped here while still borrowed |
| 153 |
|
| 154 |
error: aborting due to 14 previous errors; 1 warning emitted |
| 155 |
|
| 156 |
Some errors have detailed explanations: E0015, E0080, E0512, E0597. |
| 157 |
For more information about an error, try `rustc --explain E0015`. |