Sign in
rust
/
rust-lang
/
rust
/
refs/heads/try
/
.
/
tests
/
ui
/
array-slice-vec
/
vec-overrun.rs
blob: 3b3e9215279f9a383d0368b033e773f3e1bf370e [
file
] [
log
] [
blame
]
//@ run-fail
//@ error-pattern:index out of bounds: the len is 1 but the index is 2
//@ needs-subprocess
fn
main
()
{
let
v
:
Vec
<
isize
>
=
vec
![
10
];
let
x
:
usize
=
0
;
assert_eq
!(
v
[
x
],
10
);
// Bounds-check panic.
assert_eq
!(
v
[
x
+
2
],
20
);
}