rust-lang/const-eval#19 gives many arguments for why we should not promote const fn calls. However, we currently do promote const fn calls in const fn, even though that has all the same problems. This fails to compile, but really we shouldn't make this a hard error:
#![allow(unconditional_panic, const_err)]
const fn foo() { [()][42] }
pub const fn do_something(b: bool) -> i32 {
if b {
let _x = &foo();
}
13
}
This does not just apply to const fn calls; all promotion inside const fn should be treated like inside fn.
Cc @rust-lang/wg-const-eval
rust-lang/const-eval#19 gives many arguments for why we should not promote
const fncalls. However, we currently do promoteconst fncalls inconst fn, even though that has all the same problems. This fails to compile, but really we shouldn't make this a hard error:This does not just apply to
const fncalls; all promotion insideconst fnshould be treated like insidefn.Cc @rust-lang/wg-const-eval