]> git.lizzy.rs Git - rust.git/commitdiff
Merge ensure_node_can_be_forced into force_from_dep_node.
authorCamille GILLOT <gillot.camille@gmail.com>
Fri, 20 Mar 2020 23:21:57 +0000 (00:21 +0100)
committerCamille GILLOT <gillot.camille@gmail.com>
Mon, 23 Mar 2020 22:15:08 +0000 (23:15 +0100)
src/librustc/dep_graph/mod.rs
src/librustc_query_system/dep_graph/graph.rs
src/librustc_query_system/dep_graph/mod.rs

index 79295b2f8276759202eab7cf9703c002a9b70549..d739223f6cb5e423101f7abf1ef2f10f7a0d623b 100644 (file)
@@ -110,10 +110,6 @@ fn create_stable_hashing_context(&self) -> Self::StableHashingContext {
         TyCtxt::create_stable_hashing_context(*self)
     }
 
-    fn force_from_dep_node(&self, node: &DepNode) -> bool {
-        ty::query::force_from_dep_node(*self, node)
-    }
-
     /// Extracts the DefId corresponding to this DepNode. This will work
     /// if two conditions are met:
     ///
@@ -133,7 +129,7 @@ fn extract_def_id(&self, node: &DepNode) -> Option<DefId> {
         }
     }
 
-    fn ensure_node_can_be_forced(&self, dep_dep_node: &DepNode) -> Option<()> {
+    fn try_force_previous_green(&self, dep_dep_node: &DepNode) -> bool {
         // FIXME: This match is just a workaround for incremental bugs and should
         // be removed. https://github.com/rust-lang/rust/issues/62649 is one such
         // bug that must be fixed before removing this.
@@ -162,12 +158,12 @@ fn ensure_node_can_be_forced(&self, dep_dep_node: &DepNode) -> Option<()> {
                         // Since the given `DefPath` does not
                         // denote the item that previously
                         // existed, we just fail to mark green.
-                        return None;
+                        return false;
                     }
                 } else {
                     // If the node does not exist anymore, we
                     // just fail to mark green.
-                    return None;
+                    return false;
                 }
             }
             _ => {
@@ -175,7 +171,9 @@ fn ensure_node_can_be_forced(&self, dep_dep_node: &DepNode) -> Option<()> {
                 // forced.
             }
         }
-        Some(())
+
+        debug!("try_force_previous_green({:?}) --- trying to force", dep_dep_node);
+        ty::query::force_from_dep_node(*self, dep_dep_node)
     }
 
     fn has_errors_or_delayed_span_bugs(&self) -> bool {
index 5e004c5428ad23057ebd1a701a8e340f45589714..36edf255a775eb35ab6e065dbd44f57d25ac29e9 100644 (file)
@@ -635,8 +635,6 @@ fn try_mark_previous_green<Ctxt: DepContext<DepKind = K>>(
                             current_deps.push(node_index);
                             continue;
                         }
-                    } else {
-                        tcx.ensure_node_can_be_forced(dep_dep_node)?;
                     }
 
                     // We failed to mark it green, so we try to force the query.
@@ -645,7 +643,7 @@ fn try_mark_previous_green<Ctxt: DepContext<DepKind = K>>(
                             dependency {:?}",
                         dep_node, dep_dep_node
                     );
-                    if tcx.force_from_dep_node(dep_dep_node) {
+                    if tcx.try_force_previous_green(dep_dep_node) {
                         let dep_dep_node_color = data.colors.get(dep_dep_node_index);
 
                         match dep_dep_node_color {
index 77bc8f612932f36baf795ab090ed91ef9f49d4ad..c9983013d3896ba26ae5ced5a128d0daf6caabe0 100644 (file)
@@ -31,8 +31,8 @@ pub trait DepContext: Copy {
     /// Create a hashing context for hashing new results.
     fn create_stable_hashing_context(&self) -> Self::StableHashingContext;
 
-    /// Force the execution of a query given the associated `DepNode`.
-    fn force_from_dep_node(&self, node: &DepNode<Self::DepKind>) -> bool;
+    /// Try to force a dep node to execute and see if it's green.
+    fn try_force_previous_green(&self, node: &DepNode<Self::DepKind>) -> bool;
 
     /// Extracts the DefId corresponding to this DepNode. This will work
     /// if two conditions are met:
@@ -46,9 +46,6 @@ pub trait DepContext: Copy {
     /// has been removed.
     fn extract_def_id(&self, node: &DepNode<Self::DepKind>) -> Option<DefId>;
 
-    /// Check the legality of forcing this node.
-    fn ensure_node_can_be_forced(&self, dep_dep_node: &DepNode<Self::DepKind>) -> Option<()>;
-
     /// Return whether the current session is tainted by errors.
     fn has_errors_or_delayed_span_bugs(&self) -> bool;