3554036280
An `assume` would definitely not be worth it, but since the flag is almost free we might as well tell LLVM this, especially on `_unchecked` calls where there's no obvious way for it to deduce it. (Today neither safe nor unsafe indexing gets it: <https://rust.godbolt.org/z/G1jYT548s>)
10 lines
246 B
Rust
10 lines
246 B
Rust
#![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() {}
|