Sign in
rust
/
rust
/
8a7e1d75b2e2f4a2e89420130bca8d8d97f9074e
/
.
/
tests
/
ui
/
array-slice-vec
/
vec-overrun.rs
blob: 3b3e9215279f9a383d0368b033e773f3e1bf370e [
file
]
//@ 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
);
}