Skip to content

Commit e2ef0f7

Browse files
committed
add test for issue #54348
1 parent 055e7b7 commit e2ef0f7

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

Diff for: src/test/ui/issues/issue-54348.rs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
fn main() {
2+
[1][0u64 as usize];
3+
[1][1.5 as usize]; // ERROR index out of bounds
4+
[1][1u64 as usize]; // ERROR index out of bounds
5+
}

Diff for: src/test/ui/issues/issue-54348.stderr

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error: index out of bounds: the len is 1 but the index is 1
2+
--> $DIR/issue-54348.rs:3:5
3+
|
4+
LL | [1][1.5 as usize]; // ERROR index out of bounds
5+
| ^^^^^^^^^^^^^^^^^
6+
|
7+
= note: #[deny(const_err)] on by default
8+
9+
error: index out of bounds: the len is 1 but the index is 1
10+
--> $DIR/issue-54348.rs:4:5
11+
|
12+
LL | [1][1u64 as usize]; // ERROR index out of bounds
13+
| ^^^^^^^^^^^^^^^^^^
14+
15+
error: aborting due to 2 previous errors
16+

0 commit comments

Comments
 (0)