Skip to content

#[deprecated(note = concat!("a", "b"))] suggestion gets nowhere #146325

@cyrgani

Description

@cyrgani

Code

#[deprecated(note = concat!("a", "b"))]
struct X;

Current output

error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `concat`
 --> src/main.rs:1:21
  |
1 | #[deprecated(note = concat!("a", "b"))]
  |                     ^^^^^^
  |
help: surround the identifier with quotation marks to make it into a string literal
  |
1 | #[deprecated(note = "concat"!("a", "b"))]
  |                     +      +

Desired output

error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found macro invocation
help: macros cannot be used here

Rationale and extra context

No response

Other cases

Rust Version

rustc 1.91.0-nightly (1ed3cd703 2025-09-06)
binary: rustc
commit-hash: 1ed3cd7030718935a5c5e5c8f6581f36d8be179f
commit-date: 2025-09-06
host: x86_64-unknown-linux-gnu
release: 1.91.0-nightly
LLVM version: 21.1.0

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-attributesArea: Attributes (`#[…]`, `#![…]`)A-diagnosticsArea: Messages for errors, warnings, and lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.T-compilerRelevant to the compiler 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