]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/transmute-size-mismatch-before-typeck.stderr
Rollup merge of #70038 - DutchGhost:const-forget-tests, r=RalfJung
[rust.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:15:29
3    |
4 LL | const ZST: &[u8] = unsafe { std::mem::transmute(1usize) };
5    | ----------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^---
6    |                             |
7    |                             tried to transmute from usize to &[u8], but their sizes differed
8    |
9    = note: `#[deny(const_err)]` on by default
10
11 error: could not evaluate constant pattern
12   --> $DIR/transmute-size-mismatch-before-typeck.rs:10:9
13    |
14 LL |         ZST => {}
15    |         ^^^
16
17 error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
18   --> $DIR/transmute-size-mismatch-before-typeck.rs:15:29
19    |
20 LL | const ZST: &[u8] = unsafe { std::mem::transmute(1usize) };
21    |                             ^^^^^^^^^^^^^^^^^^^
22    |
23    = note: source type: `usize` (word size)
24    = note: target type: `&[u8]` (2 * word size)
25
26 error: could not evaluate constant pattern
27   --> $DIR/transmute-size-mismatch-before-typeck.rs:10:9
28    |
29 LL |         ZST => {}
30    |         ^^^
31
32 error: aborting due to 4 previous errors
33
34 For more information about this error, try `rustc --explain E0512`.