Make is_private_dep a query.
This commit is contained in:
parent
ee94fbb607
commit
f0e5e22806
4 changed files with 10 additions and 15 deletions
|
@ -188,6 +188,7 @@ provide! { <'tcx> tcx, def_id, other, cdata,
|
|||
crate_hash => { cdata.root.hash }
|
||||
crate_host_hash => { cdata.host_hash }
|
||||
crate_name => { cdata.root.name }
|
||||
is_private_dep => { cdata.private_dep }
|
||||
|
||||
extra_filename => { cdata.root.extra_filename.clone() }
|
||||
|
||||
|
@ -476,10 +477,6 @@ impl CrateStore for CStore {
|
|||
self.get_crate_data(cnum).root.name
|
||||
}
|
||||
|
||||
fn crate_is_private_dep_untracked(&self, cnum: CrateNum) -> bool {
|
||||
self.get_crate_data(cnum).private_dep
|
||||
}
|
||||
|
||||
fn stable_crate_id_untracked(&self, cnum: CrateNum) -> StableCrateId {
|
||||
self.get_crate_data(cnum).root.stable_crate_id
|
||||
}
|
||||
|
|
|
@ -199,7 +199,6 @@ pub trait CrateStore: std::fmt::Debug {
|
|||
|
||||
// "queries" used in resolve that aren't tracked for incremental compilation
|
||||
fn crate_name_untracked(&self, cnum: CrateNum) -> Symbol;
|
||||
fn crate_is_private_dep_untracked(&self, cnum: CrateNum) -> bool;
|
||||
fn stable_crate_id_untracked(&self, cnum: CrateNum) -> StableCrateId;
|
||||
fn crate_hash_untracked(&self, cnum: CrateNum) -> Svh;
|
||||
|
||||
|
|
|
@ -1412,6 +1412,11 @@ rustc_queries! {
|
|||
eval_always
|
||||
desc { "generating a postorder list of CrateNums" }
|
||||
}
|
||||
/// Returns whether or not the crate with CrateNum 'cnum'
|
||||
/// is marked as a private dependency
|
||||
query is_private_dep(c: CrateNum) -> bool {
|
||||
desc { "check whether crate {} is a private dependency", c }
|
||||
}
|
||||
query allocator_kind(_: ()) -> Option<AllocatorKind> {
|
||||
desc { "allocator kind for the current crate" }
|
||||
}
|
||||
|
|
|
@ -1233,16 +1233,6 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns whether or not the crate with CrateNum 'cnum'
|
||||
/// is marked as a private dependency
|
||||
pub fn is_private_dep(self, cnum: CrateNum) -> bool {
|
||||
if cnum == LOCAL_CRATE {
|
||||
false
|
||||
} else {
|
||||
self.untracked_resolutions.cstore.crate_is_private_dep_untracked(cnum)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn def_path_hash(self, def_id: DefId) -> rustc_hir::definitions::DefPathHash {
|
||||
// Accessing the definitions is ok, since all its contents are tracked by the query system.
|
||||
|
@ -2812,5 +2802,9 @@ pub fn provide(providers: &mut ty::query::Providers) {
|
|||
// We want to check if the panic handler was defined in this crate
|
||||
tcx.lang_items().panic_impl().map_or(false, |did| did.is_local())
|
||||
};
|
||||
providers.is_private_dep = |_tcx, cnum| {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
false
|
||||
};
|
||||
providers.allocator_kind = |tcx, ()| tcx.resolutions(()).cstore.allocator_kind();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue