Skip to content
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

Lint for unused unstable feature gates #63850

Closed
est31 opened this issue Aug 24, 2019 · 4 comments
Closed

Lint for unused unstable feature gates #63850

est31 opened this issue Aug 24, 2019 · 4 comments
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. A-stability Area: `#[stable]`, `#[unstable]` etc. C-feature-request Category: A feature request, i.e: not implemented / a PR. T-lang Relevant to the language team, which will review and decide on the PR/issue.

Comments

@est31
Copy link
Member

est31 commented Aug 24, 2019

I've seen two codebases now that used to have unused feature gates:

It would be cool to lint for feature gates that are still unstable but are not "used" by the codebase anywhere so they can be removed. That way, it's easy to know which nightly features a codebase actually still needs.

@jonas-schievink jonas-schievink added A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. A-stability Area: `#[stable]`, `#[unstable]` etc. C-feature-request Category: A feature request, i.e: not implemented / a PR. labels Aug 24, 2019
@joshtriplett
Copy link
Member

I'd like to see this as well.

@Centril Centril added the T-lang Relevant to the language team, which will review and decide on the PR/issue. label Aug 24, 2019
@Centril
Copy link
Contributor

Centril commented Aug 24, 2019

This seems reasonably added to the unused lint group as unused_feature.

It shouldn't be too complicated but it will require making sure that all the locations where feature gate checking is done is accounted for. Note that this is not just in libsyntax/feature_gate/check.rs but is also done in an ad-hoc fashion in later stages of compilation. To do this, you'll need to keep a set of used gates and then add features when gates were useful. This is a good opportunity to make the overall gating mechanisms less ad-hoc.

I'd be interested in hearing what @petrochenkov thinks about this from a technical POV though.

@varkor
Copy link
Member

varkor commented Aug 28, 2019

This used to exist — the tracking issue is #44232.

@est31
Copy link
Member Author

est31 commented Aug 28, 2019

Oh I see. Closing as a dupe of #44232 then. I hope it gets fixed. @Centril could you put the nominated label onto that issue instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. A-stability Area: `#[stable]`, `#[unstable]` etc. C-feature-request Category: A feature request, i.e: not implemented / a PR. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants