Closed
Description
const index: usize = 1;
fn main() {
let array = [1,2,3];
let test = 1 + array[index]; // This works fine
let error = 1 << array[index]; // error: const indexing is an unstable feature
}
For some reason, indexing an array with a const requires an unstable feature when there is a bit shift operator. help: in Nightly builds, add #![feature(const_indexing)]
to the crate attributes to enable. When adding the feature, there are no more errors but this feature shouldn't be necessary.
rustc 1.6.0-nightly (d49e365 2015-12-05)