about summary refs log tree commit diff
path: root/tests/ui/lint/unconditional_panic_promoted.rs
blob: e9ae834c8d80a37a788760042ee03f114735ed94 (plain)
1
2
3
4
5
6
7
8
//@ build-fail

fn main() {
    // MIR encodes this as a reborrow from a promoted constant.
    // But the array length can still be gotten from the type.
    let slice = &[0, 1];
    let _ = slice[2]; //~ ERROR: this operation will panic at runtime [unconditional_panic]
}