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

// error-pattern:index out of bounds: the len is 1 but the index is 2
fn main() {
    let v: ~[int] = ~[10];
    let x: int = 0;
    assert (v[x] == 10);
    // Bounds-check failure.

    assert (v[x + 2] == 20);
}