]> git.proxmox.com Git - rustc.git/blob - src/test/ui/consts/transmute-size-mismatch-before-typeck.stderr
New upstream version 1.61.0+dfsg1
[rustc.git] / src / test / ui / consts / transmute-size-mismatch-before-typeck.stderr
1 error: any use of this value will cause an error
2 --> $DIR/transmute-size-mismatch-before-typeck.rs:13:29
3 |
4 LL | const ZST: &[u8] = unsafe { std::mem::transmute(1usize) };
5 | ----------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^---
6 | |
7 | transmuting `usize` to `&[u8]` is not possible, because these types do not have the same size
8 |
9 = note: `#[deny(const_err)]` on by default
10 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
11 = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
12
13 error: could not evaluate constant pattern
14 --> $DIR/transmute-size-mismatch-before-typeck.rs:8:9
15 |
16 LL | ZST => {}
17 | ^^^
18
19 error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
20 --> $DIR/transmute-size-mismatch-before-typeck.rs:13:29
21 |
22 LL | const ZST: &[u8] = unsafe { std::mem::transmute(1usize) };
23 | ^^^^^^^^^^^^^^^^^^^
24 |
25 = note: source type: `usize` (word size)
26 = note: target type: `&[u8]` (2 * word size)
27
28 error: could not evaluate constant pattern
29 --> $DIR/transmute-size-mismatch-before-typeck.rs:8:9
30 |
31 LL | ZST => {}
32 | ^^^
33
34 error: aborting due to 4 previous errors
35
36 For more information about this error, try `rustc --explain E0512`.