pub fn rust_target_features<'a, const N: usize>(
sess: &EarlySession,
to_backend_features: impl Fn(&'a str) -> SmallVec<[&'a str; N]>,
target_base_has_feature: impl FnMut(&str) -> bool,
) -> UnordSet<Symbol>Expand description
Utility function for a codegen backend to compute the set of all actually enabled Rust target
features (which will be stored in sess.rust_target_features).
to_backend_features converts a Rust feature name into a list of backend feature names; this is
used for diagnostic purposes only.
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 (this is what
base_llvm_features computes). Note that LLVM may consider features to be implied that we do
not and vice-versa. We want cfg to be entirely consistent with Rust feature implications, and
thus only consult LLVM to expand the target CPU to target features.
We do not have to worry about RUSTC_SPECIFIC_FEATURES here, those are handled elsewhere.