Inline const
expression inside vec!
/macros should suggest adding parentheses under edition <2024
#126459
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-macros
Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
D-newcomer-roadblock
Diagnostics: Confusing error or lint; hard to understand for new users.
F-inline_const
Inline constants (aka: const blocks, const expressions, anonymous constants)
S-has-mcve
Status: A Minimal Complete and Verifiable Example has been found for this issue
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Current output
Desired output
Rationale and extra context
For compatibility reasons, macros under edition <2024 do not treat
const
as the start of anexpr
, so a layer of parentheses is needed to convince the macro to treat inline-const as an expression.Other cases
No response
Rust Version
Anything else?
https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Weird.20interaction.20between.20vec!.5B.5D.20macro.20and.20inline.20const
The text was updated successfully, but these errors were encountered: