/src/test/run-fail/vec-underrun.rs
Rust | 11 lines | 6 code | 2 blank | 3 comment | 2 complexity | 2efeea700feb8d677659bd3da42a73e1 MD5 | raw file
1// -*- rust -*- 2 3// error-pattern:bounds check 4fn main() { 5 let v: ~[int] = ~[10, 20]; 6 let x: int = 0; 7 assert (v[x] == 10); 8 // Bounds-check failure. 9 10 assert (v[x - 1] == 20); 11}