Prevent ICE in const-prop array oob check

This commit is contained in:
Oliver Scherer 2018-11-08 20:15:13 +01:00
parent 1d834550d5
commit df10965dc0
3 changed files with 21 additions and 8 deletions

View file

@ -0,0 +1,3 @@
fn main() {
[0; 3][3u64 as usize]; //~ ERROR the len is 3 but the index is 3
}

View file

@ -0,0 +1,10 @@
error: index out of bounds: the len is 3 but the index is 3
--> $DIR/const-prop-ice.rs:2:5
|
LL | [0; 3][3u64 as usize]; //~ ERROR the len is 3 but the index is 3
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: #[deny(const_err)] on by default
error: aborting due to previous error