Skip to content

Add a lint for writing #[feature] for stable features, warn by default... #21958

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Feb 7, 2015

Conversation

brson
Copy link
Contributor

@brson brson commented Feb 5, 2015

....

The 'stable_features' lint helps people progress from unstable to
stable Rust by telling them when they no longer need a feature
attribute because upstream Rust has declared it stable.

This compares to the existing 'unstable_features' lint, which is used
to implement feature staging, and triggers on any use
of #[feature].

…ult.

The 'stable_features' lint helps people progress from unstable to
stable Rust by telling them when they no longer need a `feature`
attribute because upstream Rust has declared it stable.

This compares to the existing 'unstable_features', which is used
to implement feature staging, and triggers on *any* use
of `#[feature]`.
@rust-highfive
Copy link
Contributor

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@brson
Copy link
Contributor Author

brson commented Feb 5, 2015

r? @alexcrichton cc @aturon

@alexcrichton
Copy link
Member

@bors: r+ 456d23e

@Manishearth
Copy link
Member

This seems to give me errors like:

/home/manishearth/Mozilla/rust/src/librustc_typeck/lib.rs:86:12: 86:20 error: unused or unknown feature, #[deny(unused_features)] on by default
/home/manishearth/Mozilla/rust/src/librustc_typeck/lib.rs:86 #![feature(std_misc)]

IIRC all lints are set to Deny on stage2 builds. I think.

Manishearth added a commit to Manishearth/rust that referenced this pull request Feb 6, 2015
 ....

The 'stable_features' lint helps people progress from unstable to
stable Rust by telling them when they no longer need a `feature`
attribute because upstream Rust has declared it stable.

This compares to the existing 'unstable_features' lint, which is used
to implement feature staging, and triggers on *any* use
of `#[feature]`.
@bors
Copy link
Collaborator

bors commented Feb 6, 2015

⌛ Testing commit 456d23e with merge a83f5f9...

@bors
Copy link
Collaborator

bors commented Feb 6, 2015

💔 Test failed - auto-mac-32-opt

@alexcrichton
Copy link
Member

@bors: retry

@brson
Copy link
Contributor Author

brson commented Feb 6, 2015

@Manishearth huh, the unused features lint didn't change much here. maybe a problem in other rollup patches. i'll test this again locally.

@Manishearth
Copy link
Member

Nah, I found the issue :)

@bors
Copy link
Collaborator

bors commented Feb 6, 2015

⌛ Testing commit 456d23e with merge aca22ed...

@bors
Copy link
Collaborator

bors commented Feb 6, 2015

💔 Test failed - auto-linux-64-x-android-t

@bors bors merged commit 456d23e into rust-lang:master Feb 7, 2015
Manishearth added a commit to Manishearth/rust that referenced this pull request Jun 1, 2016
…notes_version_stabilized, r=brson

stable features lint warning mentions version stabilized

To accomplish this, we alter the checks in `rustc::middle::stability` to
use the `StabilityLevel` defined in `syntax::attr` (which includes the
version in which the feature was stabilized) rather than the local
`StabilityLevel` in the same module, and make the
`declared_stable_lang_features` field of
`syntax::feature_gate::Features` hold a Vec of feature-name, span
tuples (in analogy to the `declared_lib_features` field) rather than
just spans.

Fixes rust-lang#33394.

![stable_features_version_lint_before_and_after](https://cloud.githubusercontent.com/assets/1076988/15659237/5d952a3a-267c-11e6-9181-c9e612eefd7d.png)

r? @brson (tagging Brian because he [wrote](rust-lang#21958) the lint)
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants