]> git.lizzy.rs Git - rust.git/blob - src/test/run-fail/vec-overrun.rs
Rollup merge of #65463 - nnethercote:rm-arena-allocation-from-expand_pattern, r=varkor
[rust.git] / src / test / run-fail / vec-overrun.rs
1 // error-pattern:index out of bounds: the len is 1 but the index is 2
2
3
4 fn main() {
5     let v: Vec<isize> = vec![10];
6     let x: usize = 0;
7     assert_eq!(v[x], 10);
8     // Bounds-check panic.
9
10     assert_eq!(v[x + 2], 20);
11 }