PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 1ms

/src/test/run-fail/vec-overrun.rs

http://github.com/jruderman/rust
Rust | 11 lines | 6 code | 2 blank | 3 comment | 2 complexity | 176d9e4f0ec69b21d440a042506aeb4a MD5 | raw file
 1// -*- rust -*-
 2
 3// error-pattern:bounds check
 4fn main() {
 5    let v: ~[int] = ~[10];
 6    let x: int = 0;
 7    assert (v[x] == 10);
 8    // Bounds-check failure.
 9
10    assert (v[x + 2] == 20);
11}