rust/src/test/run-fail/vec-underrun.rs
2011-07-27 15:54:33 +02:00

14 lines
201 B
Rust

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