Skip to content

RFC 2203 not implemented inside a const block #65732

Closed

Description

@ecstatic-morse

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

Activity

  1. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    B-unstableBlocker: Implemented in the nightly compiler and unstable.
    C-bugCategory: This is a bug.
    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)
    on Oct 23, 2019
  2. added
    requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.
    on Oct 24, 2019
  3. added a commit that references this issue on Oct 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)B-unstableBlocker: Implemented in the nightly compiler and unstable.C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions