…lines 1–121 unchanged (121 lines)
122
123#[cold]
124#[inline(never)]
125fn mk_cycle<'tcx, C: QueryCache>(
126 query: &'tcx QueryVTable<'tcx, C>,
127 tcx: TyCtxt<'tcx>,
128 key: C::Key,
129 cycle_error: CycleError,
130) -> C::Value {
131 let error = report_cycle(tcx.sess, &cycle_error);
132 match query.cycle_error_handling {
133 CycleErrorHandling::Error => {
134 let guar = error.emit();
135 (query.value_from_cycle_error)(tcx, key, cycle_error, guar)
136 }
137 CycleErrorHandling::DelayBug => {
138 let guar = error.delay_as_bug();
139 (query.value_from_cycle_error)(tcx, key, cycle_error, guar)
140 }
141 }
142}
143
144/// Guard object representing the responsibility to execute a query job and
145/// mark it as completed.
…lines 146–216 unchanged (71 lines)
217
218#[cold]
219#[inline(never)]
220fn cycle_error<'tcx, C: QueryCache>(
221 query: &'tcx QueryVTable<'tcx, C>,
222 tcx: TyCtxt<'tcx>,
223 key: C::Key,
224 try_execute: QueryJobId,
225 span: Span,
226) -> (C::Value, Option<DepNodeIndex>) {
227 // Ensure there was no errors collecting all active jobs.
228 // We need the complete map to ensure we find a cycle to break.
229 let job_map = collect_active_jobs_from_all_queries(tcx, false)
230 .ok()
231 .expect("failed to collect active queries");
232
233 let error = find_cycle_in_stack(try_execute, job_map, ¤t_query_job(), span);
234 (mk_cycle(query, tcx, key, error.lift()), None)
235}
236
237#[inline(always)]
238fn wait_for_query<'tcx, C: QueryCache>(
239 query: &'tcx QueryVTable<'tcx, C>,
240 tcx: TyCtxt<'tcx>,
…lines 241–272 unchanged (32 lines)
273
274 tcx.prof.query_cache_hit(index.into());
275 query_blocked_prof_timer.finish_with_query_invocation_id(index.into());
276
277 (v, Some(index))
278 }
279 Err(cycle) => (mk_cycle(query, tcx, key, cycle.lift()), None),
280 }
281}
282
283/// Shared main part of both [`execute_query_incr_inner`] and [`execute_query_non_incr_inner`].
284#[inline(never)]
285fn try_execute_query<'tcx, C: QueryCache, const INCR: bool>(
…lines 286–335 unchanged (50 lines)
336 } else {
337 let id = job.id;
338 drop(state_lock);
339
340 // If we are single-threaded we know that we have cycle error,
341 // so we just return the error.
342 cycle_error(query, tcx, key, id, span)
343 }
344 }
345 ActiveKeyStatus::Poisoned => FatalError.raise(),
346 }
347 }
348 }
…lines 349–740 unchanged (392 lines)