Skip to content

Attributes applied to macro calls are not checked #144170

@JonathanBrouwer

Description

@JonathanBrouwer

I tried this code:

macro_rules! bar {
    () => {};
}

#[link(this, is, not, checked)]
bar!();

I expected this to error, but it does not.
All attributes (this is not specific to link) applied to macro calls are not checked.
It does provide the warning:

warning: unused attribute `link`
 --> src/main.rs:5:1
  |
5 | #[link(this, is, not, checked)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |

Meta

rustc --version --verbose:

rustc 1.90.0-nightly (71e4c005c 2025-07-01)
binary: rustc
commit-hash: 71e4c005caa812a16fcb08d0bf1e6f1eda7c8381
commit-date: 2025-07-01
host: x86_64-unknown-linux-gnu
release: 1.90.0-nightly
LLVM version: 20.1.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions