]> git.lizzy.rs Git - rust.git/blob - tests/ui/array-slice-vec/vec-overrun.rs
Rollup merge of #106797 - FawazTirmizi:dev/issues/104284, r=bjorn3
[rust.git] / tests / ui / array-slice-vec / vec-overrun.rs
1 // run-fail
2 // error-pattern:index out of bounds: the len is 1 but the index is 2
3 // ignore-emscripten no processes
4
5 fn main() {
6     let v: Vec<isize> = vec![10];
7     let x: usize = 0;
8     assert_eq!(v[x], 10);
9     // Bounds-check panic.
10
11     assert_eq!(v[x + 2], 20);
12 }