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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

11 lines
180 B
Rust
Raw Normal View History

2020-04-16 06:50:32 +00:00
//@ 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];
}