rust/tests/ui/precondition-checks/out-of-bounds-get-unchecked.rs

12 lines
230 B
Rust
Raw Normal View History

//@ run-fail
//@ compile-flags: -Copt-level=3 -Cdebug-assertions=yes
//@ error-pattern: slice::get_unchecked requires
//@ ignore-debug
2024-02-07 09:30:11 -06:00
fn main() {
unsafe {
let sli: &[u8] = &[0];
sli.get_unchecked(1);
}
}