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(const_raw_ptr_to_usize_cast, const_compare_raw_pointers, const_raw_ptr_deref)]
15 // unconst and bad, will thus error in miri
16 const X: bool = &1 as *const i32 == &2 as *const i32; //~ ERROR any use of this value will cause
18 const X2: bool = 42 as *const i32 == 43 as *const i32;
20 const Y: usize = 42usize as *const i32 as usize + 1;
21 // unconst and bad, will thus error in miri
22 const Y2: usize = &1 as *const i32 as usize + 1; //~ ERROR any use of this value will cause
24 const Z: i32 = unsafe { *(&1 as *const i32) };
25 // unconst and bad, will thus error in miri
26 const Z2: i32 = unsafe { *(42 as *const i32) }; //~ ERROR any use of this value will cause
27 const Z3: i32 = unsafe { *(44 as *const i32) }; //~ ERROR any use of this value will cause