Skip to content

rustc could warn if a feature is unused #151752

@jyn514

Description

@jyn514

code:

#![crate_type = "lib"]
#![feature(unboxed_closures)]

expected behavior: A warning that unboxed_closures is unused.
actual behavior: no warning.

this will be slightly tricky to track, but i think it's possible if tcx.features were better integrated with the query system. right now, that's a single query that returns all features at once. if there were instead one query per-feature, the query system would know in detail which features were used and emit a warning if the feature was enabled but never queried. (it might also be possible to do this in a simpler way using RefCell.)

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsL-unused_featuresLint: unused_featuresT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions