mirror of
https://github.com/doukutsu-rs/rust-hos.git
synced 2026-08-24 13:18:34 -07:00
13 lines
260 B
Rust
13 lines
260 B
Rust
//@ run-fail
|
|
//@ error-pattern:index out of bounds: the len is 1 but the index is 2
|
|
//@ needs-subprocess
|
|
|
|
fn main() {
|
|
let v: Vec<isize> = vec![10];
|
|
let x: usize = 0;
|
|
assert_eq!(v[x], 10);
|
|
// Bounds-check panic.
|
|
|
|
assert_eq!(v[x + 2], 20);
|
|
}
|