2025-07-11 08:37:09 +00:00
|
|
|
#![feature(const_index, const_trait_impl)]
|
2023-04-16 11:12:37 +00:00
|
|
|
|
2023-03-04 19:10:36 -08:00
|
|
|
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) };
|
2025-07-11 08:37:09 +00:00
|
|
|
//~^ ERROR: slice::get_unchecked requires that the range is within the slice
|
2023-03-04 19:10:36 -08:00
|
|
|
|
|
|
|
|
fn main() {}
|