-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-cfgArea: `cfg` conditional compilationArea: `cfg` conditional compilationA-stabilityArea: `#[stable]`, `#[unstable]` etc.Area: `#[stable]`, `#[unstable]` etc.C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-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.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
EDIT: this is intended that cfg(target_has_atomic)
is nightly-only (not feature-gated), but I find it still very confusing.
Note that #[cfg(target_has_atomic)]
is not to be confused with #[cfg(target_has_atomic = "8")]
.
Given a snippet (just rustc --crate-type="lib"
, no additional --cfg
flags)
#[cfg(target_has_atomic)]
fn foo() {}
- On stable 1.82.0 this produces no warnings.
- On nightly 2024-11-20 this produces a
dead_code
warning indicatingtarget_has_atomic
cfg is enabled.
warning: function `foo` is never used
--> src/lib.rs:2:4
|
2 | fn foo() {}
| ^^^
|
= note: `#[warn(dead_code)]` on by default
AFAICT there is no test coverage for the intended behavior of just #[cfg(target_has_atomic)]
alone, other test coverage is mostly for check-cfg.
cc @Urgau since you worked on builtin-cfg rejection do you know anything about if this is intended, and if so, what is the intended behavior here?
Metadata
Metadata
Assignees
Labels
A-cfgArea: `cfg` conditional compilationArea: `cfg` conditional compilationA-stabilityArea: `#[stable]`, `#[unstable]` etc.Area: `#[stable]`, `#[unstable]` etc.C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-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.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.