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

Should warn for enabling the same feature twice #53032

Closed
scottmcm opened this issue Aug 3, 2018 · 1 comment · Fixed by #52644
Closed

Should warn for enabling the same feature twice #53032

scottmcm opened this issue Aug 3, 2018 · 1 comment · Fixed by #52644

Comments

@scottmcm
Copy link
Member

scottmcm commented Aug 3, 2018

I just noticed that rustc_mir is enabling in_band_lifetimes twice:

#![feature(in_band_lifetimes)]

#![feature(in_band_lifetimes)]

Would be good to have a warning to help people notice this kind of superfluous code.

@varkor
Copy link
Member

varkor commented Aug 3, 2018

This is fixed by #52644.

bors added a commit that referenced this issue Aug 6, 2018
Add errors for unknown, stable and duplicate feature attributes

- Adds an error for unknown (lang and lib) features.
- Extends the lint for unnecessary feature attributes for stable features to libs features (this already exists for lang features).
- Adds an error for duplicate (lang and lib) features.

```rust
#![feature(fake_feature)] //~ ERROR unknown feature `fake_feature`

#![feature(i128_type)] //~ WARNING the feature `i128_type` has been stable since 1.26.0

#![feature(non_exhaustive)]
#![feature(non_exhaustive)] //~ ERROR duplicate `non_exhaustive` feature attribute
```

Fixes #52053, fixes #53032 and address some of the problems noted in #44232 (though not unused features).

There are a few outstanding problems, that I haven't narrowed down yet:
- [x] Stability attributes on macros do not seem to be taken into account.
- [x] Stability attributes behind `cfg` attributes are not taken into account.
- [x] There are failing incremental tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants