Skip to content

Regression for #![feature(const_in_array_repeat_expressions)] #77138

Closed
@josephlr

Description

@josephlr

The following code used to compile on nightly, but now does not:

#![feature(const_in_array_repeat_expressions)]

struct T;

impl T {
    const fn new() -> Self {
        Self
    }
}

const fn bar() -> [T; 2] {
    [T::new(); 2]
}

Note that

static FOO: [T; 2] = [T::new(); 2];

still compiles. Adding #![feature(const_fn)] doesn't affect this issue.

I think this regression was introduced in either #76807 or #76850

CC: @ecstatic-morse @oli-obk

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions