mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 16:54:01 +00:00
9 lines
273 B
Rust
9 lines
273 B
Rust
|
//@ build-fail
|
||
|
|
||
|
fn main() {
|
||
|
// MIR encodes this as a reborrow from a promoted constant.
|
||
|
// But the array lenth can still be gotten from the type.
|
||
|
let slice = &[0, 1];
|
||
|
let _ = slice[2]; //~ ERROR: this operation will panic at runtime [unconditional_panic]
|
||
|
}
|