rust/tests/ui/precondition-checks/out-of-bounds-get-unchecked.rs
2024-02-08 19:56:30 -05:00

13 lines
292 B
Rust

// run-fail
// compile-flags: -Copt-level=3 -Cdebug-assertions=yes
// error-pattern: unsafe precondition(s) violated: hint::assert_unchecked
// ignore-debug
// ignore-wasm32-bare no panic messages
fn main() {
unsafe {
let sli: &[u8] = &[0];
sli.get_unchecked(1);
}
}