mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-02 18:27:37 +00:00
11 lines
335 B
Rust
11 lines
335 B
Rust
#![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() {}
|