Skip to content

Re-enable detection of unused library #![feature] directives #44232

Open
@alexcrichton

Description

@alexcrichton

Currently the compiler will warn users about unused #![feature] directives if they're (a) a library feature and (b) not actually ever used. The compiler doesn't currently warn you about unused #![feature] directives tied to language features.

In the process of making the stability annotations more incremental-friendly (#44137) this check in the compiler has proven to be very difficult to make incremental. Namely what's happening here is:

  • There's a function, check_stability, which is used to verify that an API can actually be used.
  • In this function if the API in question is unstable and the feature is activated, then this feature name is stored off in a side table.
  • As we run through the compiler this side table gets bigger and bigger. Right now this table is mostly built up during typeck. (I don't know the precise reason as to why it's in typeck, personally)
  • Finally near the end of compilation we go through this table and use it to warn about unused #![feature] directives.

This "put things in a table on the side" behavior isn't very incremental friently and isn't too easy to transition over to the query system. For now this specific warning seems like it probably isn't that important at Rust 1.20.0 (while it was probably very important at Rust 1.0.0). I'm going to comment this out for now so we're not going to get lints/warnings about unused library features.

This is a FIXME to track re-enabling this warning!

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language 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