Skip to content

Commit 28afaee

Browse files
committedJun 1, 2021
Make is_private_dep a query.
1 parent 7f9ab03 commit 28afaee

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed
 

‎compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ provide! { <'tcx> tcx, def_id, other, cdata,
155155
is_ctfe_mir_available => { cdata.is_ctfe_mir_available(def_id.index) }
156156

157157
dylib_dependency_formats => { cdata.get_dylib_dependency_formats(tcx) }
158+
is_private_dep => { cdata.private_dep }
158159
is_panic_runtime => { cdata.root.panic_runtime }
159160
is_compiler_builtins => { cdata.root.compiler_builtins }
160161
has_global_allocator => { cdata.root.has_global_allocator }
@@ -250,6 +251,10 @@ pub fn provide(providers: &mut Providers) {
250251
is_statically_included_foreign_item: |tcx, id| {
251252
matches!(tcx.native_library_kind(id), Some(NativeLibKind::Static { .. }))
252253
},
254+
is_private_dep: |_tcx, cnum| {
255+
assert_eq!(cnum, LOCAL_CRATE);
256+
false
257+
},
253258
native_library_kind: |tcx, id| {
254259
tcx.native_libraries(id.krate)
255260
.iter()
@@ -477,10 +482,6 @@ impl CrateStore for CStore {
477482
self.get_crate_data(cnum).root.name
478483
}
479484

480-
fn crate_is_private_dep_untracked(&self, cnum: CrateNum) -> bool {
481-
self.get_crate_data(cnum).private_dep
482-
}
483-
484485
fn stable_crate_id_untracked(&self, cnum: CrateNum) -> StableCrateId {
485486
self.get_crate_data(cnum).root.stable_crate_id
486487
}

‎compiler/rustc_middle/src/dep_graph/dep_node.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ pub type DepNode = rustc_query_system::dep_graph::DepNode<DepKind>;
285285
// required that their size stay the same, but we don't want to change
286286
// it inadvertently. This assert just ensures we're aware of any change.
287287
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
288-
static_assert_size!(DepNode, 17);
288+
static_assert_size!(DepNode, 18);
289289

290290
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
291291
static_assert_size!(DepNode, 24);

‎compiler/rustc_middle/src/middle/cstore.rs

-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ pub trait CrateStore {
199199

200200
// "queries" used in resolve that aren't tracked for incremental compilation
201201
fn crate_name_untracked(&self, cnum: CrateNum) -> Symbol;
202-
fn crate_is_private_dep_untracked(&self, cnum: CrateNum) -> bool;
203202
fn stable_crate_id_untracked(&self, cnum: CrateNum) -> StableCrateId;
204203
fn crate_hash_untracked(&self, cnum: CrateNum) -> Svh;
205204

‎compiler/rustc_middle/src/query/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1415,6 +1415,12 @@ rustc_queries! {
14151415
eval_always
14161416
desc { "generating a postorder list of CrateNums" }
14171417
}
1418+
/// Returns whether or not the crate with CrateNum 'cnum'
1419+
/// is marked as a private dependency
1420+
query is_private_dep(c: CrateNum) -> bool {
1421+
eval_always
1422+
desc { "check whether crate {} is a private dependency", c }
1423+
}
14181424

14191425
query upvars_mentioned(def_id: DefId) -> Option<&'tcx FxIndexMap<hir::HirId, hir::Upvar>> {
14201426
desc { |tcx| "collecting upvars mentioned in `{}`", tcx.def_path_str(def_id) }

‎compiler/rustc_middle/src/ty/context.rs

-6
Original file line numberDiff line numberDiff line change
@@ -1275,12 +1275,6 @@ impl<'tcx> TyCtxt<'tcx> {
12751275
}
12761276
}
12771277

1278-
/// Returns whether or not the crate with CrateNum 'cnum'
1279-
/// is marked as a private dependency
1280-
pub fn is_private_dep(self, cnum: CrateNum) -> bool {
1281-
if cnum == LOCAL_CRATE { false } else { self.cstore.crate_is_private_dep_untracked(cnum) }
1282-
}
1283-
12841278
#[inline]
12851279
pub fn def_path_hash(self, def_id: DefId) -> rustc_hir::definitions::DefPathHash {
12861280
if let Some(def_id) = def_id.as_local() {

0 commit comments

Comments
 (0)