about summary refs log tree commit diff
path: root/src/test/ui/consts/validate_never_arrays.rs
blob: 1990fb073970ecc903b6d4160341f80fd4d7c0bb (plain)
1
2
3
4
5
6
7
8
9
10
// stderr-per-bitwidth
#![feature(const_raw_ptr_deref, never_type)]

const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) }; //~ ERROR undefined behavior
const _: &[!; 0] = unsafe { &*(1_usize as *const [!; 0]) }; // ok
const _: &[!] = unsafe { &*(1_usize as *const [!; 0]) }; // ok
const _: &[!] = unsafe { &*(1_usize as *const [!; 1]) }; //~ ERROR undefined behavior
const _: &[!] = unsafe { &*(1_usize as *const [!; 42]) }; //~ ERROR undefined behavior

fn main() {}