]> git.proxmox.com Git - rustc.git/blob - src/test/ui/vec/vec-overrun.rs
New upstream version 1.45.0+dfsg1
[rustc.git] / src / test / ui / 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 }