Skip to content

Commit 9f4c888

Browse files
committed
Fully qualify the path to DepKind.
This is needed since `middle::cstore` defines another type named `DepKind`, and we should not rely on shadowing to get the right one.
1 parent e0f7b89 commit 9f4c888

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

src/librustc/ty/query/mod.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,6 @@ rustc_query_append! { [define_queries!][<'tcx>] }
150150
/// add it to the "We don't have enough information to reconstruct..." group in
151151
/// the match below.
152152
pub fn force_from_dep_node<'tcx>(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> bool {
153-
use crate::dep_graph::DepKind;
154-
155153
// We must avoid ever having to call `force_from_dep_node()` for a
156154
// `DepNode::codegen_unit`:
157155
// Since we cannot reconstruct the query key of a `DepNode::codegen_unit`, we
@@ -166,7 +164,7 @@ pub fn force_from_dep_node<'tcx>(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> bool
166164
// hit the cache instead of having to go through `force_from_dep_node`.
167165
// This assertion makes sure, we actually keep applying the solution above.
168166
debug_assert!(
169-
dep_node.kind != DepKind::codegen_unit,
167+
dep_node.kind != crate::dep_graph::DepKind::codegen_unit,
170168
"calling force_from_dep_node() on DepKind::codegen_unit"
171169
);
172170

@@ -177,14 +175,14 @@ pub fn force_from_dep_node<'tcx>(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> bool
177175
rustc_dep_node_force!([dep_node, tcx]
178176
// These are inputs that are expected to be pre-allocated and that
179177
// should therefore always be red or green already.
180-
DepKind::CrateMetadata |
178+
crate::dep_graph::DepKind::CrateMetadata |
181179

182180
// These are anonymous nodes.
183-
DepKind::TraitSelect |
181+
crate::dep_graph::DepKind::TraitSelect |
184182

185183
// We don't have enough information to reconstruct the query key of
186184
// these.
187-
DepKind::CompileCodegenUnit => {
185+
crate::dep_graph::DepKind::CompileCodegenUnit => {
188186
bug!("force_from_dep_node: encountered {:?}", dep_node)
189187
}
190188
);
@@ -193,7 +191,5 @@ pub fn force_from_dep_node<'tcx>(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> bool
193191
}
194192

195193
pub(crate) fn try_load_from_on_disk_cache<'tcx>(tcx: TyCtxt<'tcx>, dep_node: &DepNode) {
196-
use crate::dep_graph::DepKind;
197-
198194
rustc_dep_node_try_load_from_on_disk_cache!(dep_node, tcx)
199195
}

src/librustc_macros/src/query.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
429429
});
430430

431431
try_load_from_on_disk_cache_stream.extend(quote! {
432-
DepKind::#name => {
432+
::rustc::dep_graph::DepKind::#name => {
433433
if <#arg as DepNodeParams<TyCtxt<'_>>>::CAN_RECONSTRUCT_QUERY_KEY {
434434
debug_assert!($tcx.dep_graph
435435
.node_color($dep_node)
@@ -486,7 +486,7 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
486486

487487
// Add a match arm to force the query given the dep node
488488
dep_node_force_stream.extend(quote! {
489-
DepKind::#name => {
489+
::rustc::dep_graph::DepKind::#name => {
490490
if <#arg as DepNodeParams<TyCtxt<'_>>>::CAN_RECONSTRUCT_QUERY_KEY {
491491
if let Some(key) = <#arg as DepNodeParams<TyCtxt<'_>>>::recover($tcx, $dep_node) {
492492
$tcx.force_query::<crate::ty::query::queries::#name<'_>>(
@@ -509,7 +509,7 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
509509
}
510510

511511
dep_node_force_stream.extend(quote! {
512-
DepKind::Null => {
512+
::rustc::dep_graph::DepKind::Null => {
513513
bug!("Cannot force dep node: {:?}", $dep_node)
514514
}
515515
});

0 commit comments

Comments
 (0)