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