Rename all_crate_nums query to crates and remove useless wrapper
This commit is contained in:
parent
e98897e5dc
commit
c7d2099de0
21 changed files with 27 additions and 31 deletions
|
@ -229,7 +229,7 @@ pub type CrateStoreDyn = dyn CrateStore + sync::Sync;
|
|||
// positions.
|
||||
pub fn used_crates(tcx: TyCtxt<'_>, prefer: LinkagePreference) -> Vec<(CrateNum, LibSource)> {
|
||||
let mut libs = tcx
|
||||
.crates()
|
||||
.crates(())
|
||||
.iter()
|
||||
.cloned()
|
||||
.filter_map(|cnum| {
|
||||
|
|
|
@ -1444,7 +1444,7 @@ rustc_queries! {
|
|||
eval_always
|
||||
desc { "calculating the stability index for the local crate" }
|
||||
}
|
||||
query all_crate_nums(_: ()) -> &'tcx [CrateNum] {
|
||||
query crates(_: ()) -> &'tcx [CrateNum] {
|
||||
eval_always
|
||||
desc { "fetching all foreign CrateNum instances" }
|
||||
}
|
||||
|
|
|
@ -1259,10 +1259,6 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
self.stability_index(())
|
||||
}
|
||||
|
||||
pub fn crates(self) -> &'tcx [CrateNum] {
|
||||
self.all_crate_nums(())
|
||||
}
|
||||
|
||||
pub fn features(self) -> &'tcx rustc_feature::Features {
|
||||
self.features_query(())
|
||||
}
|
||||
|
@ -2819,7 +2815,7 @@ 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, ()| tcx.arena.alloc_slice(&tcx.cstore.crates_untracked());
|
||||
providers.crates = |tcx, ()| tcx.arena.alloc_slice(&tcx.cstore.crates_untracked());
|
||||
providers.output_filenames = |tcx, ()| tcx.output_filenames.clone();
|
||||
providers.features_query = |tcx, ()| tcx.sess.features_untracked();
|
||||
providers.is_panic_runtime = |tcx, cnum| {
|
||||
|
|
|
@ -2248,7 +2248,7 @@ fn for_each_def(tcx: TyCtxt<'_>, mut collect_fn: impl for<'b> FnMut(&'b Ident, N
|
|||
let queue = &mut Vec::new();
|
||||
let mut seen_defs: DefIdSet = Default::default();
|
||||
|
||||
for &cnum in tcx.crates().iter() {
|
||||
for &cnum in tcx.crates(()).iter() {
|
||||
let def_id = DefId { krate: cnum, index: CRATE_DEF_INDEX };
|
||||
|
||||
// Ignore crates that are not direct dependencies.
|
||||
|
|
|
@ -558,7 +558,7 @@ impl<'sess> OnDiskCache<'sess> {
|
|||
// maps to None.
|
||||
fn compute_cnum_map(tcx: TyCtxt<'_>) -> UnhashMap<StableCrateId, CrateNum> {
|
||||
tcx.dep_graph.with_ignore(|| {
|
||||
tcx.all_crate_nums(())
|
||||
tcx.crates(())
|
||||
.iter()
|
||||
.chain(std::iter::once(&LOCAL_CRATE))
|
||||
.map(|&cnum| {
|
||||
|
|
|
@ -215,7 +215,7 @@ pub(super) fn trait_impls_of_provider(tcx: TyCtxt<'_>, trait_id: DefId) -> Trait
|
|||
// Traits defined in the current crate can't have impls in upstream
|
||||
// crates, so we don't bother querying the cstore.
|
||||
if !trait_id.is_local() {
|
||||
for &cnum in tcx.crates().iter() {
|
||||
for &cnum in tcx.crates(()).iter() {
|
||||
for &(impl_def_id, simplified_self_ty) in
|
||||
tcx.implementations_of_trait((cnum, trait_id)).iter()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue