summary refs log tree commit diff
path: root/src/test/run-fail/vec-underrun.rs
blob: 1228e95ac1e72c68fbb7f4f6d9f422c9cfda37de (plain)
1
2
3
4
5
6
7
8
9
10
11
// -*- rust -*-

// error-pattern:bounds check
fn main() {
    let v: ~[int] = ~[10, 20];
    let x: int = 0;
    assert (v[x] == 10);
    // Bounds-check failure.

    assert (v[x - 1] == 20);
}