/src/test/run-fail/vec-underrun.rs
http://github.com/jruderman/rust · Rust · 11 lines · 6 code · 2 blank · 3 comment · 2 complexity · 2efeea700feb8d677659bd3da42a73e1 MD5 · raw file
- // -*- 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);
- }