summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/validate_never_arrays.rs
blob: a02e386c66c4d3550442cdd9edd6906f9b304999 (plain)
1
2
3
4
5
6
7
8
9
10
// stderr-per-bitwidth
#![feature(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() {}