rust/src/test/run-fail/vec-underrun.rs
2011-09-11 17:31:39 -07:00

12 lines
194 B
Rust

// -*- rust -*-
// error-pattern:bounds check
fn main() {
let v: [int] = [10, 20];
let x: int = 0;
assert (v[x] == 10);
// Bounds-check failure.
assert (v[x - 1] == 20);
}