Skip to content

Commit 0363e65

Browse files
committed
Collect active query jobs into struct QueryJobMap
1 parent 7ad4e69 commit 0363e65

File tree

5 files changed

+99
-86
lines changed

5 files changed

+99
-86
lines changed

compiler/rustc_interface/src/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ internal compiler error: query cycle handler thread panicked, aborting process";
248248
tls::with(|tcx| {
249249
// Accessing session globals is sound as they outlive `GlobalCtxt`.
250250
// They are needed to hash query keys containing spans or symbols.
251-
let query_map = rustc_span::set_session_globals_then(
251+
let job_map = rustc_span::set_session_globals_then(
252252
unsafe { &*(session_globals as *const SessionGlobals) },
253253
|| {
254254
// Ensure there were no errors collecting all active jobs.
@@ -258,7 +258,7 @@ internal compiler error: query cycle handler thread panicked, aborting process";
258258
)
259259
},
260260
);
261-
break_query_cycles(query_map, &registry);
261+
break_query_cycles(job_map, &registry);
262262
})
263263
})
264264
});

compiler/rustc_query_impl/src/execution.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use rustc_query_system::query::{
1515
use rustc_span::{DUMMY_SP, Span};
1616

1717
use crate::dep_graph::{DepContext, DepNode, DepNodeIndex};
18-
use crate::job::{QueryJobInfo, QueryMap, find_cycle_in_stack, report_cycle};
18+
use crate::job::{QueryJobInfo, QueryJobMap, find_cycle_in_stack, report_cycle};
1919
use crate::{QueryCtxt, QueryFlags, SemiDynamicQueryDispatcher};
2020

2121
#[inline]
@@ -45,8 +45,8 @@ pub(crate) fn gather_active_jobs_inner<'tcx, K: Copy>(
4545
state: &QueryState<'tcx, K>,
4646
tcx: TyCtxt<'tcx>,
4747
make_frame: fn(TyCtxt<'tcx>, K) -> QueryStackFrame<QueryStackDeferred<'tcx>>,
48-
jobs: &mut QueryMap<'tcx>,
4948
require_complete: bool,
49+
job_map_out: &mut QueryJobMap<'tcx>, // Out-param; job info is gathered into this map
5050
) -> Option<()> {
5151
let mut active = Vec::new();
5252

@@ -77,7 +77,7 @@ pub(crate) fn gather_active_jobs_inner<'tcx, K: Copy>(
7777
// queries leading to a deadlock.
7878
for (key, job) in active {
7979
let frame = make_frame(tcx, key);
80-
jobs.insert(job.id, QueryJobInfo { frame, job });
80+
job_map_out.insert(job.id, QueryJobInfo { frame, job });
8181
}
8282

8383
Some(())
@@ -213,12 +213,12 @@ fn cycle_error<'tcx, C: QueryCache, const FLAGS: QueryFlags>(
213213
) -> (C::Value, Option<DepNodeIndex>) {
214214
// Ensure there was no errors collecting all active jobs.
215215
// We need the complete map to ensure we find a cycle to break.
216-
let query_map = qcx
216+
let job_map = qcx
217217
.collect_active_jobs_from_all_queries(false)
218218
.ok()
219219
.expect("failed to collect active queries");
220220

221-
let error = find_cycle_in_stack(try_execute, query_map, &qcx.current_query_job(), span);
221+
let error = find_cycle_in_stack(try_execute, job_map, &qcx.current_query_job(), span);
222222
(mk_cycle(query, qcx, error.lift()), None)
223223
}
224224

0 commit comments

Comments
 (0)