Closed
Description
#![feature(const_fn)]
const fn test(x: usize) -> i32 {
[42;5][x]
}
fn main () {
let _ = test(5);
}
I guess we cannot const evaluate the index anymore but must translate it with llvm's constant evaluator, because it might only be available as a value we got from a static. But then I'm not sure how to do the range check.
Nope, that's not a problem. Is there any reason not to thin out trans/consts down to the point where it's just a thin wrapper around const_eval + translation of ConstVal
to ValueRef
?
I mean after #25570 (const indexing), since after that I think the const_eval is feature-equivalent with the const translator.