Skip to content

Commit ffa7ce4

Browse files
committed
Add more regression tests
1 parent df10965 commit ffa7ce4

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/test/ui/consts/const-prop-ice2.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
fn main() {
2+
enum Enum { One=1 }
3+
let xs=[0;1 as usize];
4+
println!("{}", xs[Enum::One as usize]); //~ ERROR the len is 1 but the index is 1
5+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: index out of bounds: the len is 1 but the index is 1
2+
--> $DIR/const-prop-ice2.rs:4:20
3+
|
4+
LL | println!("{}", xs[Enum::One as usize]); //~ ERROR the len is 1 but the index is 1
5+
| ^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: #[deny(const_err)] on by default
8+
9+
error: aborting due to previous error
10+

0 commit comments

Comments
 (0)