-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)C-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
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.
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)C-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️