2024-08-24 18:19:38 +00:00
|
|
|
//@ build-fail
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
// MIR encodes this as a reborrow from a promoted constant.
|
2024-12-19 21:38:12 +08:00
|
|
|
// But the array length can still be gotten from the type.
|
2024-08-24 18:19:38 +00:00
|
|
|
let slice = &[0, 1];
|
|
|
|
|
let _ = slice[2]; //~ ERROR: this operation will panic at runtime [unconditional_panic]
|
|
|
|
|
}
|