Skip to content

Commit 8225c2c

Browse files
committed
Update comments
1 parent 8d5dc5f commit 8225c2c

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

compiler/rustc_interface/src/util.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,10 @@ pub(crate) fn run_in_thread_pool_with_globals<F: FnOnce(CurrentGcx) -> R + Send,
195195
tls::with(|tcx| {
196196
let (query_map, complete) = QueryCtxt::new(tcx).collect_active_jobs();
197197
if !complete {
198+
// There was an unexpected error collecting all active jobs, which we need
199+
// to find cycles to break.
200+
// We want to avoid panicking in the deadlock handler, so we abort instead.
198201
eprintln!("internal compiler error: failed to get query map in deadlock handler, aborting process");
199-
// We need to abort here as we failed to resolve the deadlock,
200-
// otherwise the compiler could just hang,
201202
process::abort();
202203
}
203204
query_map

compiler/rustc_query_impl/src/plumbing.rs

+2
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ impl QueryContext for QueryCtxt<'_> {
7979
tls::with_related_context(self.tcx, |icx| icx.query)
8080
}
8181

82+
/// Returns a query map representing active query jobs and a bool being false
83+
/// if there was an error constructing the map.
8284
fn collect_active_jobs(self) -> (QueryMap, bool) {
8385
let mut jobs = QueryMap::default();
8486
let mut complete = true;

compiler/rustc_query_system/src/query/plumbing.rs

+3
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,10 @@ where
261261
Qcx: QueryContext,
262262
{
263263
let (query_map, complete) = qcx.collect_active_jobs();
264+
// Ensure there was no errors collecting all active jobs.
265+
// We need the complete map to ensure we find a cycle to break.
264266
assert!(complete, "failed to collect active queries");
267+
265268
let error = try_execute.find_cycle_in_stack(query_map, &qcx.current_query_job(), span);
266269
(mk_cycle(query, qcx, error), None)
267270
}

0 commit comments

Comments
 (0)