Closed
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