rust-lang / rust-lang/rust

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

Open
#139,892 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-lints A-stability C-enhancement T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search the compiler for uses of UnstableFeatures::is_nightly_build and audit existing nightly-only features, including #[cfg(target_has_atomic)]. Start by identifying checks that are only for diagnostics or occur very early in session building. Done means the existing features are covered by gates and the internal lint reports other uses, with explicit allows for the permitted cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.