add test for issue #54348

This commit is contained in:
Andy Russell 2018-11-14 12:54:32 -05:00
parent 055e7b7258
commit e2ef0f742c
No known key found for this signature in database
GPG key ID: BE2221033EDBC374
2 changed files with 21 additions and 0 deletions

View file

@ -0,0 +1,5 @@
fn main() {
[1][0u64 as usize];
[1][1.5 as usize]; // ERROR index out of bounds
[1][1u64 as usize]; // ERROR index out of bounds
}

View file

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