/// Given the list of enabled features that were not language features (i.e. that
/// were expected to be library features), and the list of features used from
/// libraries, identify activated features that don't exist and error about them.
Given the list of enabled features that were not language features , and the list of features used from
libraries, identify activated features that don't exist and error about them.
Given the list of enabled features that were not language features and the list of features used from libraries identify activated features that don ' t exist and error about them .
pub fn check_unused_or_stable_features(sess: &Session,
                                       lib_features_used: &FnvHashMap<InternedString,
                                                                      attr::StabilityLevel>) {
    let ref declared_lib_features = sess.features.borrow().declared_lib_features;
    let mut remaining_lib_features: FnvHashMap<InternedString, Span>
        = declared_lib_features.clone().into_iter().collect();
    let stable_msg = "this feature is stable. attribute no longer needed";
    for &span in &sess.features.borrow().declared_stable_lang_features {
        sess.add_lint(lint::builtin::STABLE_FEATURES,
                      ast::CRATE_NODE_ID,
                      span,
                      stable_msg.to_string());
    }
    for (used_lib_feature, level) in lib_features_used {
        match remaining_lib_features.remove(used_lib_feature) {
            Some(span) => {
                if *level == attr::Stable {
                    sess.add_lint(lint::builtin::STABLE_FEATURES,
                                  ast::CRATE_NODE_ID,
                                  span,
                                  stable_msg.to_string());
                }
            }
            None => ( /* used but undeclared, handled during the previous ast visit */ )
        }
    }
    for &span in remaining_lib_features.values() {
        sess.add_lint(lint::builtin::UNUSED_FEATURES,
                      ast::CRATE_NODE_ID,
                      span,
                      "unused or unknown feature".to_string());
    }
}
pub fn check_unused_or_stable_features ( sess : & Session , lib_features_used : & FnvHashMap < InternedString , attr :: StabilityLevel > ) { let ref declared_lib_features = sess . features . borrow ( ) . declared_lib_features ; let mut remaining_lib_features : FnvHashMap < InternedString , Span > = declared_lib_features . clone ( ) . into_iter ( ) . collect ( ) ; let stable_msg = " " ; for & span in & sess . features . borrow ( ) . declared_stable_lang_features { sess . add_lint ( lint :: builtin :: STABLE_FEATURES , ast :: CRATE_NODE_ID , span , stable_msg . to_string ( ) ) ; } for ( used_lib_feature , level ) in lib_features_used { match remaining_lib_features . remove ( used_lib_feature ) { Some ( span ) => { if * level == attr :: Stable { sess . add_lint ( lint :: builtin :: STABLE_FEATURES , ast :: CRATE_NODE_ID , span , stable_msg . to_string ( ) ) ; } } None => ( /* used but undeclared, handled during the previous ast visit */ ) } } for & span in remaining_lib_features . values ( ) { sess . add_lint ( lint :: builtin :: UNUSED_FEATURES , ast :: CRATE_NODE_ID , span , " " . to_string ( ) ) ; } }
Given the list of enabled features that were not language features (i.e.
Given the list of enabled features that were not language features ( i . e .
sess
&Session
lib_features_used
&FnvHashMap<InternedString,
                                                                      attr::StabilityLevel>