rust/tests/ui/consts/const-eval/ub-slice-get-unchecked.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

10 lines
246 B
Rust
Raw Normal View History

#![feature(const_slice_index)]
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) };
fn main() {}