2020-04-16 06:50:32 +00:00
|
|
|
// run-fail
|
2012-09-29 11:34:11 +00:00
|
|
|
// error-pattern:index out of bounds: the len is 1 but the index is 2
|
2020-05-07 15:39:02 +00:00
|
|
|
// ignore-emscripten no processes
|
2014-03-05 23:28:08 +00:00
|
|
|
|
2010-06-24 04:03:09 +00:00
|
|
|
fn main() {
|
2016-05-27 02:39:36 +00:00
|
|
|
let v: Vec<isize> = vec![10];
|
2015-03-26 00:06:52 +00:00
|
|
|
let x: usize = 0;
|
2014-10-15 06:05:01 +00:00
|
|
|
assert_eq!(v[x], 10);
|
2014-10-09 19:17:22 +00:00
|
|
|
// Bounds-check panic.
|
2011-06-15 18:19:50 +00:00
|
|
|
|
2014-10-15 06:05:01 +00:00
|
|
|
assert_eq!(v[x + 2], 20);
|
2011-08-10 16:27:22 +00:00
|
|
|
}
|