Skip to content

add an internal lint for nightly-channel-only features without a feature gate #139892

Open
@jyn514

Description

@jyn514

we really should not have features that are available only on nightly but do not have a feature gate. this leads to people unknowingly using unstable features, which in turn leads to situations where we have no choice but to stabilize features unchanged because otherwise we break too much of the ecosystem. it also defeats the whole point of -Z allow-features.

we should do two things:

  • audit all existing features to make sure they have a feature gate. @jieyouxu tells me that at least #[cfg(target_has_atomic)] does not.
  • add an internal lint against UnstableFeatures::is_nightly_build. basically the only reason it's valid to check this is for diagnostics, or very early in session building, and both of those can add an explicit allow().

@rustbot label A-stability

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.A-stabilityArea: `#[stable]`, `#[unstable]` etc.C-enhancementCategory: 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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions