-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-langRelevant to the language teamRelevant to the language team
Description
Currently one cannot call unreachable_unchecked
in constant functions, so one cannot add hints of the form:
const fn foo(x: i32) -> i32 {
if x < 0 { unreachable_unchecked() } else { x * 2 }
}
These types of hints can heavily influence code generation, which can substantially change the performance of const fn
when they are invoked at run-time.
It would be a shame to have to write and call foo_compile_time
and foo_run_time
because the code generated for foo_compile_time
is sub-par.
This issue has been assigned to @canova via this comment.
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-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-langRelevant to the language teamRelevant to the language team