about summary refs log tree commit diff
path: root/compiler/rustc_query_system/src
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_query_system/src')
-rw-r--r--compiler/rustc_query_system/src/dep_graph/mod.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/compiler/rustc_query_system/src/dep_graph/mod.rs b/compiler/rustc_query_system/src/dep_graph/mod.rs
index cbd80295887..cfb25ec905f 100644
--- a/compiler/rustc_query_system/src/dep_graph/mod.rs
+++ b/compiler/rustc_query_system/src/dep_graph/mod.rs
@@ -51,20 +51,24 @@ pub trait DepContext: Copy {
     }
 
     /// Try to force a dep node to execute and see if it's green.
+    ///
+    /// Returns true if the query has actually been forced. It is valid that a query
+    /// fails to be forced, e.g. when the query key cannot be reconstructed from the
+    /// dep-node or when the query kind outright does not support it.
     #[inline]
     #[instrument(skip(self, frame), level = "debug")]
     fn try_force_from_dep_node(self, dep_node: DepNode, frame: Option<&MarkFrame<'_>>) -> bool {
         let cb = self.dep_kind_info(dep_node.kind);
         if let Some(f) = cb.force_from_dep_node {
-            if let Err(value) = panic::catch_unwind(panic::AssertUnwindSafe(|| {
-                f(self, dep_node);
-            })) {
-                if !value.is::<rustc_errors::FatalErrorMarker>() {
-                    print_markframe_trace(self.dep_graph(), frame);
+            match panic::catch_unwind(panic::AssertUnwindSafe(|| f(self, dep_node))) {
+                Err(value) => {
+                    if !value.is::<rustc_errors::FatalErrorMarker>() {
+                        print_markframe_trace(self.dep_graph(), frame);
+                    }
+                    panic::resume_unwind(value)
                 }
-                panic::resume_unwind(value)
+                Ok(query_has_been_forced) => query_has_been_forced,
             }
-            true
         } else {
             false
         }