-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Suggest const block, instead of const item, for array repeat of non-Copy element #126894
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
F-inline_const
Inline constants (aka: const blocks, const expressions, anonymous constants)
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
@rustbot claim |
Is that a thing? I am not sure |
|
Ah, thank you! Completely missed it. Should I make the Should I add the |
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Jun 24, 2024
…r=davidtwco Suggest inline const blocks for array initialization rust-lang#126894
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Jun 24, 2024
…r=davidtwco Suggest inline const blocks for array initialization rust-lang#126894
compiler-errors
added a commit
to compiler-errors/rust
that referenced
this issue
Jun 24, 2024
…r=davidtwco Suggest inline const blocks for array initialization rust-lang#126894
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Jun 24, 2024
Rollup merge of rust-lang#126899 - GrigorenkoPV:suggest-const-block, r=davidtwco Suggest inline const blocks for array initialization rust-lang#126894
Close it since #126899 is merged. |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
F-inline_const
Inline constants (aka: const blocks, const expressions, anonymous constants)
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Uh oh!
There was an error while loading. Please reload this page.
Code
Current output
Rationale and extra context
Rustc's suggestion to make this code compile with a non-Copy type is:
Instead it should be:
Relatedly, now that const blocks are a stable part of the language since Rust 1.79 (https://blog.rust-lang.org/2024/06/13/Rust-1.79.0.html#inline-const-expressions), I don't think the diagnostic should be linking to the initial const block RFC.
Rust Version
The text was updated successfully, but these errors were encountered: