Sign in
android
/
toolchain
/
rustc
/
59fbe18bc79ed87d0c5f02705e7cf19e402e1f2b
/
.
/
src
/
test
/
ui
/
array-slice-vec
/
vec-overrun.rs
blob: bdc7d507d53056864760ffc629aea84738c28547 [
file
] [
log
] [
blame
]
// run-fail
// error-pattern:index out of bounds: the len is 1 but the index is 2
// ignore-emscripten no processes
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
);
}