1 // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 #![feature(reverse_bits, int_to_from_bytes)]
14 let x: &'static i32 = &(5_i32.reverse_bits());
15 //~^ ERROR does not live long enough
16 let y: &'static i32 = &(i32::from_be_bytes([0x12, 0x34, 0x56, 0x78]));
17 //~^ ERROR does not live long enough
18 let z: &'static i32 = &(i32::from_le_bytes([0x12, 0x34, 0x56, 0x78]));
19 //~^ ERROR does not live long enough
20 let a: &'static i32 = &(i32::from_be(i32::from_ne_bytes([0x80, 0, 0, 0])));
21 //~^ ERROR does not live long enough
22 let b: &'static [u8] = &(0x12_34_56_78_i32.to_be_bytes());
23 //~^ ERROR does not live long enough
24 let c: &'static [u8] = &(0x12_34_56_78_i32.to_le_bytes());
25 //~^ ERROR does not live long enough
26 let d: &'static [u8] = &(i32::min_value().to_be().to_ne_bytes());
27 //~^ ERROR does not live long enough