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 references to features not defined in Cargo.toml #1614

Closed
clarfonthey opened this issue Mar 9, 2017 · 2 comments
Closed

Lint references to features not defined in Cargo.toml #1614

clarfonthey opened this issue Mar 9, 2017 · 2 comments
Labels
A-lint Area: New lints E-medium Call for participation: Medium difficulty level problem and requires some initial experience. L-style Lint: Belongs in the style lint group S-needs-discussion Status: Needs further discussion before merging or work can be started T-cargo Type: cargo related

Comments

@clarfonthey
Copy link
Contributor

For example, a #[cfg(feature = "blah")] when blah isn't in the [features] or [dependencies] sections of Cargo.toml. This may require some people to put a blah = [] thing in the [features] section but I think it'd be worthwhile as a warn-by-default.

@oli-obk
Copy link
Contributor

oli-obk commented Mar 10, 2017

Unfortunately this is nigh impossible due to the fact that cfgs are expanded before clippy has a chance to run. Also we do not have cargo metadata available. It could be in cargo clippy, but we'll have to decide to add such Lint's, since we've never done that before. We probably need to pass the data to the linting rustc instance through env cars, so it's not pretty either. Alternatively we can lint directly from cargo clippy by parsing the crate from there (maybe through syn?)

@oli-obk oli-obk added L-style Lint: Belongs in the style lint group S-needs-discussion Status: Needs further discussion before merging or work can be started E-medium Call for participation: Medium difficulty level problem and requires some initial experience. A-lint Area: New lints labels Mar 10, 2017
@oli-obk oli-obk added the T-cargo Type: cargo related label May 11, 2017
@jplatte
Copy link
Contributor

jplatte commented Feb 8, 2022

I just learned there is a merged RFC for doing this in the compiler itself! This can probably be closed in favor of rust-lang/rust#82450 🙂

@oli-obk oli-obk closed this as completed Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints E-medium Call for participation: Medium difficulty level problem and requires some initial experience. L-style Lint: Belongs in the style lint group S-needs-discussion Status: Needs further discussion before merging or work can be started T-cargo Type: cargo related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants