Skip to content

Commit

Permalink
add test for issue rust-lang#54348
Browse files Browse the repository at this point in the history
  • Loading branch information
euclio committed Nov 14, 2018
1 parent 055e7b7 commit e2ef0f7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/test/ui/issues/issue-54348.rs
Original file line number Diff line number Diff line change
@@ -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
}
16 changes: 16 additions & 0 deletions src/test/ui/issues/issue-54348.stderr
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e2ef0f7

Please sign in to comment.