Function rustc_passes::stability::check_features
source · fn check_features<'tcx>(
tcx: TyCtxt<'tcx>,
remaining_lib_features: &mut FxIndexMap<&Symbol, Span>,
remaining_implications: &mut FxHashMap<Symbol, Symbol>,
defined_features: &[(Symbol, Option<Symbol>)],
all_implications: &FxHashMap<Symbol, Symbol>
)Expand description
For each feature in defined_features..
- If it is in
remaining_lib_features(those features with#![feature(..)]attributes in the current crate), check if it is stable (or partially stable) and thus an unnecessary attribute. - If it is in
remaining_implications(a feature that is referenced by animplied_byfrom the current crate), then remove it from the remaining implications.
Once this function has been invoked for every feature (local crate and all extern crates), then..
- If features remain in
remaining_lib_features, then the user has enabled a feature that does not exist. - If features remain in
remaining_implications, theimplied_byrefers to a feature that does not exist.
By structuring the code in this way: checking the features defined from each crate one at a time, less loading from metadata is performed and thus compiler performance is improved.