Use () for lang items.
This commit is contained in:
parent
9849327384
commit
437a46ddfa
8 changed files with 30 additions and 53 deletions
|
@ -1330,7 +1330,7 @@ rustc_queries! {
|
|||
desc { |tcx| "computing crate imported by `{}`", tcx.def_path_str(def_id.to_def_id()) }
|
||||
}
|
||||
|
||||
query get_lib_features(_: CrateNum) -> LibFeatures {
|
||||
query get_lib_features(_: ()) -> LibFeatures {
|
||||
storage(ArenaCacheSelector<'tcx>)
|
||||
eval_always
|
||||
desc { "calculating the lib features map" }
|
||||
|
@ -1340,16 +1340,14 @@ rustc_queries! {
|
|||
desc { "calculating the lib features defined in a crate" }
|
||||
}
|
||||
/// Returns the lang items defined in another crate by loading it from metadata.
|
||||
// FIXME: It is illegal to pass a `CrateNum` other than `LOCAL_CRATE` here, just get rid
|
||||
// of that argument?
|
||||
query get_lang_items(_: CrateNum) -> LanguageItems {
|
||||
query get_lang_items(_: ()) -> LanguageItems {
|
||||
storage(ArenaCacheSelector<'tcx>)
|
||||
eval_always
|
||||
desc { "calculating the lang items map" }
|
||||
}
|
||||
|
||||
/// Returns all diagnostic items defined in all crates.
|
||||
query all_diagnostic_items(_: CrateNum) -> FxHashMap<Symbol, DefId> {
|
||||
query all_diagnostic_items(_: ()) -> FxHashMap<Symbol, DefId> {
|
||||
storage(ArenaCacheSelector<'tcx>)
|
||||
eval_always
|
||||
desc { "calculating the diagnostic items map" }
|
||||
|
@ -1411,12 +1409,12 @@ rustc_queries! {
|
|||
desc { |tcx| "names_imported_by_glob_use for `{}`", tcx.def_path_str(def_id.to_def_id()) }
|
||||
}
|
||||
|
||||
query stability_index(_: CrateNum) -> stability::Index<'tcx> {
|
||||
query stability_index(_: ()) -> stability::Index<'tcx> {
|
||||
storage(ArenaCacheSelector<'tcx>)
|
||||
eval_always
|
||||
desc { "calculating the stability index for the local crate" }
|
||||
}
|
||||
query all_crate_nums(_: CrateNum) -> &'tcx [CrateNum] {
|
||||
query all_crate_nums(_: ()) -> &'tcx [CrateNum] {
|
||||
eval_always
|
||||
desc { "fetching all foreign CrateNum instances" }
|
||||
}
|
||||
|
@ -1644,7 +1642,7 @@ rustc_queries! {
|
|||
desc { |tcx| "estimating size for `{}`", tcx.def_path_str(def.def_id()) }
|
||||
}
|
||||
|
||||
query features_query(_: CrateNum) -> &'tcx rustc_feature::Features {
|
||||
query features_query(_: ()) -> &'tcx rustc_feature::Features {
|
||||
eval_always
|
||||
desc { "looking up enabled feature gates" }
|
||||
}
|
||||
|
|
|
@ -1218,18 +1218,18 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
}
|
||||
|
||||
pub fn lib_features(self) -> &'tcx middle::lib_features::LibFeatures {
|
||||
self.get_lib_features(LOCAL_CRATE)
|
||||
self.get_lib_features(())
|
||||
}
|
||||
|
||||
/// Obtain all lang items of this crate and all dependencies (recursively)
|
||||
pub fn lang_items(self) -> &'tcx rustc_hir::lang_items::LanguageItems {
|
||||
self.get_lang_items(LOCAL_CRATE)
|
||||
self.get_lang_items(())
|
||||
}
|
||||
|
||||
/// Obtain the given diagnostic item's `DefId`. Use `is_diagnostic_item` if you just want to
|
||||
/// compare against another `DefId`, since `is_diagnostic_item` is cheaper.
|
||||
pub fn get_diagnostic_item(self, name: Symbol) -> Option<DefId> {
|
||||
self.all_diagnostic_items(LOCAL_CRATE).get(&name).copied()
|
||||
self.all_diagnostic_items(()).get(&name).copied()
|
||||
}
|
||||
|
||||
/// Check whether the diagnostic item with the given `name` has the given `DefId`.
|
||||
|
@ -1238,11 +1238,11 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
}
|
||||
|
||||
pub fn stability(self) -> &'tcx stability::Index<'tcx> {
|
||||
self.stability_index(LOCAL_CRATE)
|
||||
self.stability_index(())
|
||||
}
|
||||
|
||||
pub fn crates(self) -> &'tcx [CrateNum] {
|
||||
self.all_crate_nums(LOCAL_CRATE)
|
||||
self.all_crate_nums(())
|
||||
}
|
||||
|
||||
pub fn allocator_kind(self) -> Option<AllocatorKind> {
|
||||
|
@ -1250,7 +1250,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
}
|
||||
|
||||
pub fn features(self) -> &'tcx rustc_feature::Features {
|
||||
self.features_query(LOCAL_CRATE)
|
||||
self.features_query(())
|
||||
}
|
||||
|
||||
pub fn def_key(self, id: DefId) -> rustc_hir::definitions::DefKey {
|
||||
|
@ -2815,18 +2815,12 @@ pub fn provide(providers: &mut ty::query::Providers) {
|
|||
tcx.stability().local_deprecation_entry(id)
|
||||
};
|
||||
providers.extern_mod_stmt_cnum = |tcx, id| tcx.extern_crate_map.get(&id).cloned();
|
||||
providers.all_crate_nums = |tcx, cnum| {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
tcx.arena.alloc_slice(&tcx.cstore.crates_untracked())
|
||||
};
|
||||
providers.all_crate_nums = |tcx, ()| tcx.arena.alloc_slice(&tcx.cstore.crates_untracked());
|
||||
providers.output_filenames = |tcx, cnum| {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
tcx.output_filenames.clone()
|
||||
};
|
||||
providers.features_query = |tcx, cnum| {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
tcx.sess.features_untracked()
|
||||
};
|
||||
providers.features_query = |tcx, ()| tcx.sess.features_untracked();
|
||||
providers.is_panic_runtime = |tcx, cnum| {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
tcx.sess.contains_name(tcx.hir().krate_attrs(), sym::panic_runtime)
|
||||
|
|
|
@ -579,7 +579,7 @@ impl<'sess> OnDiskCache<'sess> {
|
|||
) -> IndexVec<CrateNum, Option<CrateNum>> {
|
||||
tcx.dep_graph.with_ignore(|| {
|
||||
let current_cnums = tcx
|
||||
.all_crate_nums(LOCAL_CRATE)
|
||||
.all_crate_nums(())
|
||||
.iter()
|
||||
.map(|&cnum| {
|
||||
let crate_name = tcx.original_crate_name(cnum).to_string();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue