Skip to content

Commit 157008d

Browse files
committed
Update comments
1 parent 077b8d5 commit 157008d

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

Diff for: 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

Diff for: 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;

Diff for: compiler/rustc_query_system/src/query/plumbing.rs

+3
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,10 @@ where
251251
Qcx: QueryContext,
252252
{
253253
let (query_map, complete) = qcx.collect_active_jobs();
254+
// Ensure there was no errors collecting all active jobs.
255+
// We need the complete map to ensure we find a cycle to break.
254256
assert!(complete, "failed to collect active queries");
257+
255258
let error = try_execute.find_cycle_in_stack(query_map, &qcx.current_query_job(), span);
256259
(mk_cycle(query, qcx, error), None)
257260
}

0 commit comments

Comments
 (0)