Remove lift_query_info.

It doesn't use `self`, which means it doesn't need to be part of the
`QueryContext` trait; we can just call `extract` directly where
necessary.
This commit is contained in:
Nicholas Nethercote 2026-01-30 14:45:35 +11:00
parent 8340622e14
commit cd1c773661
4 changed files with 11 additions and 26 deletions

View file

@ -104,13 +104,6 @@ impl<'tcx> QueryContext<'tcx> for QueryCtxt<'tcx> {
if complete { Ok(jobs) } else { Err(jobs) }
}
fn lift_query_info(
self,
info: &QueryStackDeferred<'tcx>,
) -> rustc_query_system::query::QueryStackFrameExtra {
info.extract()
}
// Interactions with on_disk_cache
fn load_side_effect(
self,
@ -174,10 +167,7 @@ impl<'tcx> QueryContext<'tcx> for QueryCtxt<'tcx> {
self.tcx.sess.dcx().emit_fatal(QueryOverflow {
span: info.job.span,
note: QueryOverflowNote {
desc: self.lift_query_info(&info.query.info).description,
depth,
},
note: QueryOverflowNote { desc: info.query.info.extract().description, depth },
suggested_limit,
crate_name: self.tcx.crate_name(LOCAL_CRATE),
});

View file

@ -27,11 +27,8 @@ pub struct QueryInfo<I> {
}
impl<'tcx> QueryInfo<QueryStackDeferred<'tcx>> {
pub(crate) fn lift<Qcx: QueryContext<'tcx>>(
&self,
qcx: Qcx,
) -> QueryInfo<QueryStackFrameExtra> {
QueryInfo { span: self.span, query: self.query.lift(qcx) }
pub(crate) fn lift(&self) -> QueryInfo<QueryStackFrameExtra> {
QueryInfo { span: self.span, query: self.query.lift() }
}
}
@ -628,7 +625,7 @@ pub fn print_query_stack<'tcx, Qcx: QueryContext<'tcx>>(
let Some(query_info) = query_map.get(&query) else {
break;
};
let query_extra = qcx.lift_query_info(&query_info.query.info);
let query_extra = query_info.query.info.extract();
if Some(count_printed) < limit_frames || limit_frames.is_none() {
// Only print to stderr as many stack frames as `num_frames` when present.
dcx.struct_failure_note(format!(

View file

@ -70,9 +70,9 @@ impl<'tcx> QueryStackFrame<QueryStackDeferred<'tcx>> {
Self { info, def_id, dep_kind, hash, def_id_for_ty_in_cycle }
}
fn lift<Qcx: QueryContext<'tcx>>(&self, qcx: Qcx) -> QueryStackFrame<QueryStackFrameExtra> {
fn lift(&self) -> QueryStackFrame<QueryStackFrameExtra> {
QueryStackFrame {
info: qcx.lift_query_info(&self.info),
info: self.info.extract(),
dep_kind: self.dep_kind,
hash: self.hash,
def_id: self.def_id,
@ -168,8 +168,6 @@ pub trait QueryContext<'tcx>: HasDepContext {
fn collect_active_jobs(self, require_complete: bool) -> Result<QueryMap<'tcx>, QueryMap<'tcx>>;
fn lift_query_info(self, info: &QueryStackDeferred<'tcx>) -> QueryStackFrameExtra;
/// Load a side effect associated to the node in the previous session.
fn load_side_effect(
self,

View file

@ -253,10 +253,10 @@ pub struct CycleError<I = QueryStackFrameExtra> {
}
impl<'tcx> CycleError<QueryStackDeferred<'tcx>> {
fn lift<Qcx: QueryContext<'tcx>>(&self, qcx: Qcx) -> CycleError<QueryStackFrameExtra> {
fn lift(&self) -> CycleError<QueryStackFrameExtra> {
CycleError {
usage: self.usage.as_ref().map(|(span, frame)| (*span, frame.lift(qcx))),
cycle: self.cycle.iter().map(|info| info.lift(qcx)).collect(),
usage: self.usage.as_ref().map(|(span, frame)| (*span, frame.lift())),
cycle: self.cycle.iter().map(|info| info.lift()).collect(),
}
}
}
@ -297,7 +297,7 @@ where
let query_map = qcx.collect_active_jobs(false).ok().expect("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.lift(qcx)), None)
(mk_cycle(query, qcx, error.lift()), None)
}
#[inline(always)]
@ -345,7 +345,7 @@ where
(v, Some(index))
}
Err(cycle) => (mk_cycle(query, qcx, cycle.lift(qcx)), None),
Err(cycle) => (mk_cycle(query, qcx, cycle.lift()), None),
}
}