1 #![feature(inclusive_range_syntax, plugin)]
4 #![deny(indexing_slicing)]
5 #![deny(out_of_bounds_indexing)]
12 x[4]; //~ERROR: const index is out of bounds
13 x[1 << 3]; //~ERROR: const index is out of bounds
14 &x[1..5]; //~ERROR: range is out of bounds
16 &x[0...4]; //~ERROR: range is out of bounds
20 &x[5..]; //~ERROR: range is out of bounds
22 &x[..5]; //~ERROR: range is out of bounds
25 y[0]; //~ERROR: indexing may panic
26 &y[1..2]; //~ERROR: slicing may panic
28 &y[0...4]; //~ERROR: slicing may panic
30 let empty: [i8; 0] = [];
31 empty[0]; //~ERROR: const index is out of bounds
32 &empty[1..5]; //~ERROR: range is out of bounds
33 &empty[0...4]; //~ERROR: range is out of bounds
37 &empty[0...0]; //~ERROR: range is out of bounds
39 &empty[1..]; //~ERROR: range is out of bounds
40 &empty[..4]; //~ERROR: range is out of bounds