rust/src/test/run-fail/vec-underrun.rs

13 lines
204 B
Rust
Raw Normal View History

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