Prevent ICE in const-prop array oob check
This commit is contained in:
parent
1d834550d5
commit
df10965dc0
3 changed files with 21 additions and 8 deletions
3
src/test/ui/consts/const-prop-ice.rs
Normal file
3
src/test/ui/consts/const-prop-ice.rs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
[0; 3][3u64 as usize]; //~ ERROR the len is 3 but the index is 3
|
||||
}
|
||||
10
src/test/ui/consts/const-prop-ice.stderr
Normal file
10
src/test/ui/consts/const-prop-ice.stderr
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
error: index out of bounds: the len is 3 but the index is 3
|
||||
--> $DIR/const-prop-ice.rs:2:5
|
||||
|
|
||||
LL | [0; 3][3u64 as usize]; //~ ERROR the len is 3 but the index is 3
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(const_err)] on by default
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue