Function cfg_target_feature

Source
pub fn cfg_target_feature(
    sess: &Session,
    target_base_has_feature: impl FnMut(&str) -> bool,
) -> (Vec<Symbol>, Vec<Symbol>)
Expand description

Utility function for a codegen backend to compute cfg(target_feature), or more specifically, to populate sess.unstable_target_features and sess.target_features (these are the first and 2nd component of the return value, respectively).

target_base_has_feature should check whether the given feature (a Rust feature name!) is enabled in the “base” target machine, i.e., without applying -Ctarget-feature.

We do not have to worry about RUSTC_SPECIFIC_FEATURES here, those are handled elsewhere.