-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.L-unused_attributesLint: unused_attributesLint: unused_attributesT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Description
Code
I tried this code:
macro_rules! mac {
() => {};
}
#[cfg_attr(target_os = "none", cfg(target_has_atomic = "ptr"))]
mac!();
I expected to see this happen: no warning
Instead, this happened: unused_attributes warns cfg_attr
warning: unused attribute `<cfg_attr>`
--> src/lib.rs:5:1
|
5 | #[cfg_attr(target_os = "none", cfg(target_has_atomic = "ptr"))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the built-in attribute `<cfg_attr>` will be ignored, since it's applied to the macro invocation `mac`
--> src/lib.rs:6:1
|
6 | mac!();
| ^^^
= note: `#[warn(unused_attributes)]` on by default
Version it worked on
It most recently worked on: nightly-2025-03-20
Version with regression
nightly-2025-03-21
rustc --version --verbose
:
rustc 1.87.0-nightly (78948ac25 2025-03-20)
binary: rustc
commit-hash: 78948ac259253ce89effca1e8bb64d16f4684aa4
commit-date: 2025-03-20
host: aarch64-apple-darwin
release: 1.87.0-nightly
LLVM version: 20.1.1
@rustbot modify labels: +regression-from-stable-to-nightly -regression-untriaged +A-attributes
tamird
Metadata
Metadata
Assignees
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.L-unused_attributesLint: unused_attributesLint: unused_attributesT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.