Sign in
fuchsia
/
third_party
/
rust
/
0.4
/
.
/
src
/
test
/
run-fail
/
vec-underrun.rs
blob: 88b29471dac1fea651d0e7a6b26abbc256aff26e [
file
] [
log
] [
blame
]
// -*- rust -*-
// error-pattern:index out of bounds: the len is 2 but the index is -1
fn
main
()
{
let
v
:
~[
int
]
=
~[
10
,
20
];
let
x
:
int
=
0
;
assert
(
v
[
x
]
==
10
);
// Bounds-check failure.
assert
(
v
[
x
-
1
]
==
20
);
}