about summary refs log tree commit diff
path: root/tests/ui/consts/validate_never_arrays.rs
blob: b0ea064188bcf5d16a3d28bdbe4c84fb0ce3c0c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
// Strip out raw byte dumps to make comparison platform-independent:
//@ normalize-stderr: "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
//@ normalize-stderr: "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?(<imm>)?─*╼ )+ *│.*" -> "HEX_DUMP"
#![feature(never_type)]

const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) }; //~ ERROR invalid value
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 invalid value
const _: &[!] = unsafe { &*(1_usize as *const [!; 42]) }; //~ ERROR invalid value

fn main() {}