about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2025-03-18 14:36:28 +0100
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2025-03-21 07:37:56 +0100
commit157008d7117ec9ca13b70c38058639524437112f (patch)
treea97a03ff94cdd59aec2e227cf4bc48bc7e0cc56c
parent077b8d5c370391d428dbb4d3d037f6e51b1349a8 (diff)
downloadrust-157008d7117ec9ca13b70c38058639524437112f.tar.gz
rust-157008d7117ec9ca13b70c38058639524437112f.zip
Update comments
-rw-r--r--compiler/rustc_interface/src/util.rs5
-rw-r--r--compiler/rustc_query_impl/src/plumbing.rs2
-rw-r--r--compiler/rustc_query_system/src/query/plumbing.rs3
3 files changed, 8 insertions, 2 deletions
diff --git a/compiler/rustc_interface/src/util.rs b/compiler/rustc_interface/src/util.rs
index 0904795529e..249b80bb31d 100644
--- a/compiler/rustc_interface/src/util.rs
+++ b/compiler/rustc_interface/src/util.rs
@@ -195,9 +195,10 @@ pub(crate) fn run_in_thread_pool_with_globals<F: FnOnce(CurrentGcx) -> R + Send,
                     tls::with(|tcx| {
                         let (query_map, complete) = QueryCtxt::new(tcx).collect_active_jobs();
                         if !complete {
+                            // There was an unexpected error collecting all active jobs, which we need
+                            // to find cycles to break.
+                            // We want to avoid panicking in the deadlock handler, so we abort instead.
                             eprintln!("internal compiler error: failed to get query map in deadlock handler, aborting process");
-                            // We need to abort here as we failed to resolve the deadlock,
-                            // otherwise the compiler could just hang,
                             process::abort();
                         }
                         query_map
diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs
index 85abb77e53c..301bcac4ca7 100644
--- a/compiler/rustc_query_impl/src/plumbing.rs
+++ b/compiler/rustc_query_impl/src/plumbing.rs
@@ -79,6 +79,8 @@ impl QueryContext for QueryCtxt<'_> {
         tls::with_related_context(self.tcx, |icx| icx.query)
     }
 
+    /// Returns a query map representing active query jobs and a bool being false
+    /// if there was an error constructing the map.
     fn collect_active_jobs(self) -> (QueryMap, bool) {
         let mut jobs = QueryMap::default();
         let mut complete = true;
diff --git a/compiler/rustc_query_system/src/query/plumbing.rs b/compiler/rustc_query_system/src/query/plumbing.rs
index 68590854343..dc1d6f760fa 100644
--- a/compiler/rustc_query_system/src/query/plumbing.rs
+++ b/compiler/rustc_query_system/src/query/plumbing.rs
@@ -251,7 +251,10 @@ where
     Qcx: QueryContext,
 {
     let (query_map, complete) = qcx.collect_active_jobs();
+    // Ensure there was no errors collecting all active jobs.
+    // We need the complete map to ensure we find a cycle to break.
     assert!(complete, "failed to collect active queries");
+
     let error = try_execute.find_cycle_in_stack(query_map, &qcx.current_query_job(), span);
     (mk_cycle(query, qcx, error), None)
 }