]> git.lizzy.rs Git - rust.git/blob - src/test/run-fail/vec-overrun.rs
Auto merge of #63994 - Centril:refactor-qualify-consts, r=spastorino,oli-obk
[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 }