rust/src/test/run-fail/vec-overrun.rs
Brian Anderson 518dc52f85 Reformat
This changes the indexing syntax from .() to [], the vector syntax from ~[] to
[] and the extension syntax from #fmt() to #fmt[]
2011-08-20 11:04:00 -07:00

12 lines
205 B
Rust

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