Getting a list of features used by a crate

Does rustc expose any facilities for outputting a list of features (both unstable and anything that was ever unstable in the past) used by a crate? I think such a tool could be used to provide useful information about the minimum stable version of Rust required for a crate, to be displayed on crates.io. If there isn’t already an external interface for doing this, could someone point me in the right direction to find where this information is determined by the compiler during the compilation process? Also, if I wanted to build such a tool as a command built into rustc, would that require an RFC? Thanks!

I don’t think there is such interface.

Feature checking is implemented in src/libsyntax/feature_gate.rs. From a cursory look, it seems such feature should be easy to implement. Good luck!

It is part of the stabilisation process to remove the code that checks whether a feature is being used in a codebase or not.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.