Closed
Description
Thanks to RFC 2203, code like the following compiles on nightly:
fn main() {
let _: [Option<Box<i32>>; 4] = [None; 4];
}
However, as pointed out by @RalfJung, the same code fails to compile in a const
block (Playground):
const _: [Option<Box<i32>>; 4] = [None; 4];
Currently, there's two distinct implementations for promotion of temps, one for fn
and const fn
and one for const
and static
. RFC 2203 is implemented for the first but not the second.
I didn't see an actual issue for this. I'll close this as a dupe if @RalfJung already opened one.
cc #49147