os-rust/src/test/run-fail/vec-overrun.rs

14 lines
195 B
Rust
Raw Normal View History

2010-06-23 21:03:09 -07:00
// -*- rust -*-
// error-pattern:bounds check
2010-06-23 21:03:09 -07:00
fn main() {
let vec[int] v = [10];
let int x = 0;
assert (v.(x) == 10);
// Bounds-check failure.
assert (v.(x + 2) == 20);
}