rust/tests/ui/array-slice-vec/bounds-check-no-overflow.rs

11 lines
180 B
Rust
Raw Normal View History

//@ run-fail
//@ error-pattern:index out of bounds
//@ needs-subprocess
use std::mem::size_of;
fn main() {
2015-01-25 21:05:03 +00:00
let xs = [1, 2, 3];
2015-02-27 00:43:55 +00:00
xs[usize::MAX / size_of::<isize>() + 1];
}