Skip to content

Commit 7350f65

Browse files
committed
Auto merge of #85908 - cjgillot:private-dep-query, r=Aaron1011
Make is_private_dep a query. Part of #85153 r? `@Aaron1011`
2 parents d20b9ad + 28afaee commit 7350f65

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
@@ -1414,6 +1414,12 @@ rustc_queries! {
14141414
eval_always
14151415
desc { "generating a postorder list of CrateNums" }
14161416
}
1417+
/// Returns whether or not the crate with CrateNum 'cnum'
1418+
/// is marked as a private dependency
1419+
query is_private_dep(c: CrateNum) -> bool {
1420+
eval_always
1421+
desc { "check whether crate {} is a private dependency", c }
1422+
}
14171423

14181424
query upvars_mentioned(def_id: DefId) -> Option<&'tcx FxIndexMap<hir::HirId, hir::Upvar>> {
14191425
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
@@ -1264,12 +1264,6 @@ impl<'tcx> TyCtxt<'tcx> {
12641264
}
12651265
}
12661266

1267-
/// Returns whether or not the crate with CrateNum 'cnum'
1268-
/// is marked as a private dependency
1269-
pub fn is_private_dep(self, cnum: CrateNum) -> bool {
1270-
if cnum == LOCAL_CRATE { false } else { self.cstore.crate_is_private_dep_untracked(cnum) }
1271-
}
1272-
12731267
#[inline]
12741268
pub fn def_path_hash(self, def_id: DefId) -> rustc_hir::definitions::DefPathHash {
12751269
if let Some(def_id) = def_id.as_local() {

0 commit comments

Comments
 (0)