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