rust/tests/compile-fail/array_indexing.rs

14 lines
265 B
Rust
Raw Normal View History

2015-12-21 18:22:29 +00:00
#![feature(plugin)]
#![plugin(clippy)]
#![deny(out_of_bounds_indexing)]
2016-02-11 12:50:41 +00:00
#![allow(no_effect)]
2015-12-21 18:22:29 +00:00
fn main() {
let x = [1,2,3,4];
x[0];
x[3];
x[4]; //~ERROR: const index-expr is out of bounds
x[1 << 3]; //~ERROR: const index-expr is out of bounds
}