Move supported_target_features query provider to cg_ssa

This commit is contained in:
bjorn3 2020-10-09 19:35:17 +02:00
parent 53a4c3b0ba
commit 46f2f023b0
4 changed files with 20 additions and 20 deletions

View file

@ -144,6 +144,7 @@ pub struct CodegenResults {
pub fn provide(providers: &mut Providers) {
crate::back::symbol_export::provide(providers);
crate::base::provide_both(providers);
crate::target_features::provide(providers);
}
pub fn provide_extern(providers: &mut Providers) {

View file

@ -1,3 +1,5 @@
use rustc_hir::def_id::LOCAL_CRATE;
use rustc_middle::ty::query::Providers;
use rustc_session::Session;
use rustc_span::symbol::sym;
use rustc_span::symbol::Symbol;
@ -148,3 +150,16 @@ pub fn supported_target_features(sess: &Session) -> &'static [(&'static str, Opt
_ => &[],
}
}
pub(crate) fn provide(providers: &mut Providers) {
providers.supported_target_features = |tcx, cnum| {
assert_eq!(cnum, LOCAL_CRATE);
if tcx.sess.opts.actually_rustdoc {
// rustdoc needs to be able to document functions that use all the features, so
// whitelist them all
all_known_features().map(|(a, b)| (a.to_string(), b)).collect()
} else {
supported_target_features(tcx.sess).iter().map(|&(a, b)| (a.to_string(), b)).collect()
}
};
}