]> git.lizzy.rs Git - rust.git/commitdiff
Fully qualify the path to DepKind.
authorCamille GILLOT <gillot.camille@gmail.com>
Sun, 22 Mar 2020 23:16:00 +0000 (00:16 +0100)
committerCamille GILLOT <gillot.camille@gmail.com>
Mon, 23 Mar 2020 22:17:59 +0000 (23:17 +0100)
This is needed since `middle::cstore` defines another type named
`DepKind`, and we should not rely on shadowing to get the right one.

src/librustc/ty/query/mod.rs
src/librustc_macros/src/query.rs

index a59824f684d89e0bcadd2635114de4712204b7e5..b45b3b3f539eafeae96a7936036c8c8151eb90ee 100644 (file)
 /// 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)
 }
index 4474543466312a776f77f4774c0499093edd1f20..e7005f2f5ba775578e5fcd5ffa3c69f0d77246e9 100644 (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)
         }
     });