]> git.lizzy.rs Git - rust.git/blob - src/doc/unstable-book/src/const-indexing.md
Rollup merge of #40521 - TimNN:panic-free-shift, r=alexcrichton
[rust.git] / src / doc / unstable-book / src / const-indexing.md
1 # `const_indexing`
2
3 The tracking issue for this feature is: [#29947]
4
5 [#29947]: https://github.com/rust-lang/rust/issues/29947
6
7 ------------------------
8
9 The `const_indexing` feature allows the constant evaluation of index operations
10 on constant arrays and repeat expressions.
11
12 ## Examples
13
14 ```rust
15 #![feature(const_indexing)]
16
17 const ARR: [usize; 5] = [1, 2, 3, 4, 5];
18 const ARR2: [usize; ARR[1]] = [42, 99];
19 ```