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.
This commit is contained in:
Camille GILLOT 2020-03-23 00:16:00 +01:00
parent e0f7b897ba
commit 9f4c8889e5
2 changed files with 7 additions and 11 deletions

View File

@ -150,8 +150,6 @@ rustc_query_append! { [define_queries!][<'tcx>] }
/// add it to the "We don't have enough information to reconstruct..." group in
/// the match below.
pub fn force_from_dep_node<'tcx>(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> bool {
use crate::dep_graph::DepKind;
// We must avoid ever having to call `force_from_dep_node()` for a
// `DepNode::codegen_unit`:
// 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
// hit the cache instead of having to go through `force_from_dep_node`.
// This assertion makes sure, we actually keep applying the solution above.
debug_assert!(
dep_node.kind != DepKind::codegen_unit,
dep_node.kind != crate::dep_graph::DepKind::codegen_unit,
"calling force_from_dep_node() on DepKind::codegen_unit"
);
@ -177,14 +175,14 @@ pub fn force_from_dep_node<'tcx>(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> bool
rustc_dep_node_force!([dep_node, tcx]
// These are inputs that are expected to be pre-allocated and that
// should therefore always be red or green already.
DepKind::CrateMetadata |
crate::dep_graph::DepKind::CrateMetadata |
// These are anonymous nodes.
DepKind::TraitSelect |
crate::dep_graph::DepKind::TraitSelect |
// We don't have enough information to reconstruct the query key of
// these.
DepKind::CompileCodegenUnit => {
crate::dep_graph::DepKind::CompileCodegenUnit => {
bug!("force_from_dep_node: encountered {:?}", dep_node)
}
);
@ -193,7 +191,5 @@ pub fn force_from_dep_node<'tcx>(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> bool
}
pub(crate) fn try_load_from_on_disk_cache<'tcx>(tcx: TyCtxt<'tcx>, dep_node: &DepNode) {
use crate::dep_graph::DepKind;
rustc_dep_node_try_load_from_on_disk_cache!(dep_node, tcx)
}

View File

@ -429,7 +429,7 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
});
try_load_from_on_disk_cache_stream.extend(quote! {
DepKind::#name => {
::rustc::dep_graph::DepKind::#name => {
if <#arg as DepNodeParams<TyCtxt<'_>>>::CAN_RECONSTRUCT_QUERY_KEY {
debug_assert!($tcx.dep_graph
.node_color($dep_node)
@ -486,7 +486,7 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
// Add a match arm to force the query given the dep node
dep_node_force_stream.extend(quote! {
DepKind::#name => {
::rustc::dep_graph::DepKind::#name => {
if <#arg as DepNodeParams<TyCtxt<'_>>>::CAN_RECONSTRUCT_QUERY_KEY {
if let Some(key) = <#arg as DepNodeParams<TyCtxt<'_>>>::recover($tcx, $dep_node) {
$tcx.force_query::<crate::ty::query::queries::#name<'_>>(
@ -509,7 +509,7 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
}
dep_node_force_stream.extend(quote! {
DepKind::Null => {
::rustc::dep_graph::DepKind::Null => {
bug!("Cannot force dep node: {:?}", $dep_node)
}
});