allow indexing into constant arrays
This commit is contained in:
parent
af5d9d65e7
commit
6683fa4d42
10 changed files with 190 additions and 28 deletions
|
@ -9,7 +9,10 @@
|
|||
// except according to those terms.
|
||||
|
||||
const FOO: [u32; 3] = [1, 2, 3];
|
||||
const BAR: u32 = FOO[5]; //~ ERROR const index-expr is out of bounds
|
||||
const BAR: u32 = FOO[5]; // no error, because the error below occurs before regular const eval
|
||||
|
||||
const BLUB: [u32; FOO[4]] = [5, 6];
|
||||
//~^ ERROR array length constant evaluation error: array index out of bounds [E0250]
|
||||
|
||||
fn main() {
|
||||
let _ = BAR;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue