diff options
Diffstat (limited to 'src/test/ui/consts/validate_never_arrays.rs')
-rw-r--r-- | src/test/ui/consts/validate_never_arrays.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/ui/consts/validate_never_arrays.rs b/src/test/ui/consts/validate_never_arrays.rs new file mode 100644 index 000000000..a02e386c6 --- /dev/null +++ b/src/test/ui/consts/validate_never_arrays.rs @@ -0,0 +1,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() {} |