Description
openedon Aug 8, 2018
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment