-
Notifications
You must be signed in to change notification settings - Fork 13.3k
add an internal lint for nightly-channel-only features without a feature gate #139892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
There are a few different ways for arbitrary compiler code to check whether the compiler is nightly:
So it would be useful to audit all of these. I could also imagine splitting some of these APIs into diagnostic-only and non-diagnostic variants, so that it's easier to audit the legitimate exceptions. |
FWIW, |
All unstable cfg's are implicitly available on the nightly channel. Note that cargo needs to know which cfg's are set before compiling a single line of rust code (so |
what does cargo need this information for? my understanding is that this is an internal feature that is only used by libstd - we shouldn't have
we should ban unstable cfgs at the crate root IMO.
that makes sense to me and is a little trickier - perhaps it could continue to be "false", but not silently? where we give a future-incompat lint that the behavior may change, and you can use |
|
got it, that makes sense. i still think "continues to evaluate to false until you enable a feature gate, warns if the gate is disabled" is a reasonable solution and better than enabling unconditionally on nightly.
target_has_atomic with a value (e.g. 16) is stable, but target_has_atomic without a value is not. |
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:
#[cfg(target_has_atomic)]
does not.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 explicitallow()
.@rustbot label A-stability
The text was updated successfully, but these errors were encountered: