1
Fork 0

Fix ICE in OUT_OF_BOUNDS_INDEXING with ranges

This commit is contained in:
mcarton 2016-03-14 21:48:24 +01:00
parent 893d6e8bf2
commit 1546cc4798
2 changed files with 22 additions and 11 deletions

View file

@ -16,6 +16,8 @@ fn main() {
&x[0...4]; //~ERROR: range is out of bounds
&x[..];
&x[1..];
&x[4..];
&x[5..]; //~ERROR: range is out of bounds
&x[..4];
&x[..5]; //~ERROR: range is out of bounds
@ -24,4 +26,16 @@ fn main() {
&y[1..2]; //~ERROR: slicing may panic
&y[..];
&y[0...4]; //~ERROR: slicing may panic
let empty: [i8; 0] = [];
empty[0]; //~ERROR: const index is out of bounds
&empty[1..5]; //~ERROR: range is out of bounds
&empty[0...4]; //~ERROR: range is out of bounds
&empty[..];
&empty[0..];
&empty[0..0];
&empty[0...0]; //~ERROR: range is out of bounds
&empty[..0];
&empty[1..]; //~ERROR: range is out of bounds
&empty[..4]; //~ERROR: range is out of bounds
}