Add more regression tests
This commit is contained in:
parent
df10965dc0
commit
ffa7ce4290
5
src/test/ui/consts/const-prop-ice2.rs
Normal file
5
src/test/ui/consts/const-prop-ice2.rs
Normal file
@ -0,0 +1,5 @@
|
||||
fn main() {
|
||||
enum Enum { One=1 }
|
||||
let xs=[0;1 as usize];
|
||||
println!("{}", xs[Enum::One as usize]); //~ ERROR the len is 1 but the index is 1
|
||||
}
|
10
src/test/ui/consts/const-prop-ice2.stderr
Normal file
10
src/test/ui/consts/const-prop-ice2.stderr
Normal file
@ -0,0 +1,10 @@
|
||||
error: index out of bounds: the len is 1 but the index is 1
|
||||
--> $DIR/const-prop-ice2.rs:4:20
|
||||
|
|
||||
LL | println!("{}", xs[Enum::One as usize]); //~ ERROR the len is 1 but the index is 1
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(const_err)] on by default
|
||||
|
||||
error: aborting due to previous error
|
||||
|
Loading…
Reference in New Issue
Block a user