]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/const-int-conversion.rs
Rollup merge of #106427 - mejrs:translation_errors, r=davidtwco
[rust.git] / tests / ui / consts / const-int-conversion.rs
1 fn main() {
2     let x: &'static i32 = &(5_i32.reverse_bits());
3         //~^ ERROR temporary value dropped while borrowed
4     let y: &'static i32 = &(i32::from_be_bytes([0x12, 0x34, 0x56, 0x78]));
5         //~^ ERROR temporary value dropped while borrowed
6     let z: &'static i32 = &(i32::from_le_bytes([0x12, 0x34, 0x56, 0x78]));
7         //~^ ERROR temporary value dropped while borrowed
8     let a: &'static i32 = &(i32::from_be(i32::from_ne_bytes([0x80, 0, 0, 0])));
9         //~^ ERROR temporary value dropped while borrowed
10     let b: &'static [u8] = &(0x12_34_56_78_i32.to_be_bytes());
11         //~^ ERROR temporary value dropped while borrowed
12     let c: &'static [u8] = &(0x12_34_56_78_i32.to_le_bytes());
13         //~^ ERROR temporary value dropped while borrowed
14     let d: &'static [u8] = &(i32::MIN.to_be().to_ne_bytes());
15         //~^ ERROR temporary value dropped while borrowed
16 }