2010-06-23 21:03:09 -07:00
|
|
|
// -*- rust -*-
|
|
|
|
|
2011-05-12 21:45:29 +02:00
|
|
|
// error-pattern:bounds check
|
2011-08-10 13:36:57 -07:00
|
|
|
// no-valgrind
|
2010-06-23 21:03:09 -07:00
|
|
|
fn main() {
|
2011-08-12 15:42:39 -07:00
|
|
|
let v: [int] = ~[10];
|
2011-07-27 14:19:39 +02:00
|
|
|
let x: int = 0;
|
2011-06-15 11:19:50 -07:00
|
|
|
assert (v.(x) == 10);
|
|
|
|
// Bounds-check failure.
|
|
|
|
|
|
|
|
assert (v.(x + 2) == 20);
|
|
|
|
}
|