about summary refs log tree commit diff
path: root/tests/ui/consts/const-eval/ub-slice-get-unchecked.rs
blob: ad2b49e60498d827fb2d696ff50f418537122fff (plain)
1
2
3
4
5
6
7
8
9
10
#![feature(const_index, const_trait_impl)]

const A: [(); 5] = [(), (), (), (), ()];

// Since the indexing is on a ZST, the addresses are all fine,
// but we should still catch the bad range.
const B: &[()] = unsafe { A.get_unchecked(3..1) };
//~^ ERROR: slice::get_unchecked requires that the range is within the slice

fn main() {}