Skip to content

Errors about unknown attributes when attr macro failed to resolve #121555

Open
@Noratrieb

Description

@Noratrieb

Code

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=bf6b5515ea450d277b8556a6f0205911

#[derive(ILove)]
struct A {
    #[beans]
    pub yes: bool,
}

Current output

error: cannot find derive macro `ILove` in this scope
 --> src/lib.rs:1:10
  |
1 | #[derive(ILove)]
  |          ^^^^^

error: cannot find attribute `beans` in this scope
 --> src/lib.rs:3:7
  |
3 |     #[beans]
  |       ^^^^^

Desired output

error: cannot find derive macro `ILove` in this scope
 --> src/lib.rs:1:10
  |
1 | #[derive(ILove)]
  |          ^^^^^

Rationale and extra context

The beans attribute may be provided by the proc macro, this error is a useless and noisy follow-up error which should be suppressed.

Other cases

#[you_love]
struct A {
    #[beans]
    pub yes: bool,
}

Rust Version

nightly-2024-02-24

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-attributesArea: Attributes (`#[…]`, `#![…]`)A-diagnosticsArea: Messages for errors, warnings, and lintsA-resolveArea: Name/path resolution done by `rustc_resolve` specificallyD-verboseDiagnostics: Too much output caused by a single piece of incorrect code.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