]> git.proxmox.com Git - rustc.git/blame - src/test/ui/consts/const-eval/promoted_raw_ptr_ops.rs
New upstream version 1.46.0~beta.2+dfsg1
[rustc.git] / src / test / ui / consts / const-eval / promoted_raw_ptr_ops.rs
CommitLineData
f035d41b 1#![feature(const_raw_ptr_to_usize_cast, const_raw_ptr_deref)]
7453a54e 2
a7813a04 3fn main() {
b7449926 4 let x: &'static bool = &(42 as *const i32 == 43 as *const i32);
48663c56
XL
5 //~^ ERROR temporary value dropped while borrowed
6 let y: &'static usize = &(&1 as *const i32 as usize + 1);
7 //~^ ERROR temporary value dropped while borrowed
8 let z: &'static i32 = &(unsafe { *(42 as *const i32) });
9 //~^ ERROR temporary value dropped while borrowed
10 let a: &'static bool = &(main as fn() == main as fn());
11 //~^ ERROR temporary value dropped while borrowed
223e47cc 12}