/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
- // -*- rust -*-
- // error-pattern:bounds check
- fn main() {
- let v: ~[int] = ~[10];
- let x: int = 0;
- assert (v[x] == 10);
- // Bounds-check failure.
- assert (v[x + 2] == 20);
- }