Skip to content

Array repeat exprs dont permit non-copy adt ctors as elements #139642

Open
@BoxyUwU

Description

@BoxyUwU

I tried this code:

fn main() {
  struct Foo;
  [Foo; 2];
}

I expected to see this happen: it works because we attempt to permit paths to const items as repeat expr elements without Copy holding. It's also trivial to just write [const { Foo }; 2] so the lack of expressiveness doesn't really matter here too much but it feels somewhat inconsistent

Instead, this happened: error

Meta

rustc --version --verbose:

latest playground

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-langRelevant to the language team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions