]> git.lizzy.rs Git - rust.git/blob - src/test/ui/error-codes/E0396.rs
Stabilize File::options()
[rust.git] / src / test / ui / error-codes / E0396.rs
1 // gate-test-const_raw_ptr_deref
2
3 const REG_ADDR: *const u8 = 0x5f3759df as *const u8;
4
5 const VALUE: u8 = unsafe { *REG_ADDR };
6 //~^ ERROR dereferencing raw pointers in constants is unstable
7
8 const unsafe fn unreachable() -> ! {
9     use std::convert::Infallible;
10
11     const INFALLIBLE: *const Infallible = [].as_ptr();
12     match *INFALLIBLE {}
13     //~^ ERROR dereferencing raw pointers in constant functions is unstable
14
15     const BAD: () = unsafe { match *INFALLIBLE {} };
16     //~^ ERROR dereferencing raw pointers in constants is unstable
17 }
18
19 fn main() {
20 }