]> git.lizzy.rs Git - rust.git/blob - src/test/ui/error-codes/E0396.rs
Rollup merge of #85766 - workingjubilee:file-options, r=yaahc
[rust.git] / src / test / ui / error-codes / E0396.rs
1 const REG_ADDR: *mut u8 = 0x5f3759df as *mut u8;
2
3 const VALUE: u8 = unsafe { *REG_ADDR };
4 //~^ ERROR dereferencing raw mutable pointers in constants is unstable
5
6 const unsafe fn unreachable() -> ! {
7     use std::convert::Infallible;
8
9     const INFALLIBLE: *mut Infallible = &[] as *const [Infallible] as *const _ as _;
10     match *INFALLIBLE {}
11     //~^ ERROR dereferencing raw mutable pointers in constant functions is unstable
12
13     const BAD: () = unsafe { match *INFALLIBLE {} };
14     //~^ ERROR dereferencing raw mutable pointers in constants is unstable
15 }
16
17 fn main() {
18 }