Skip to content

Commit cd1c773

Browse files
committed
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.
1 parent 8340622 commit cd1c773

4 files changed

Lines changed: 11 additions & 26 deletions

File tree

compiler/rustc_query_impl/src/plumbing.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,6 @@ impl<'tcx> QueryContext<'tcx> for QueryCtxt<'tcx> {
104104
if complete { Ok(jobs) } else { Err(jobs) }
105105
}
106106

107-
fn lift_query_info(
108-
self,
109-
info: &QueryStackDeferred<'tcx>,
110-
) -> rustc_query_system::query::QueryStackFrameExtra {
111-
info.extract()
112-
}
113-
114107
// Interactions with on_disk_cache
115108
fn load_side_effect(
116109
self,
@@ -174,10 +167,7 @@ impl<'tcx> QueryContext<'tcx> for QueryCtxt<'tcx> {
174167

175168
self.tcx.sess.dcx().emit_fatal(QueryOverflow {
176169
span: info.job.span,
177-
note: QueryOverflowNote {
178-
desc: self.lift_query_info(&info.query.info).description,
179-
depth,
180-
},
170+
note: QueryOverflowNote { desc: info.query.info.extract().description, depth },
181171
suggested_limit,
182172
crate_name: self.tcx.crate_name(LOCAL_CRATE),
183173
});

compiler/rustc_query_system/src/query/job.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,8 @@ pub struct QueryInfo<I> {
2727
}
2828

2929
impl<'tcx> QueryInfo<QueryStackDeferred<'tcx>> {
30-
pub(crate) fn lift<Qcx: QueryContext<'tcx>>(
31-
&self,
32-
qcx: Qcx,
33-
) -> QueryInfo<QueryStackFrameExtra> {
34-
QueryInfo { span: self.span, query: self.query.lift(qcx) }
30+
pub(crate) fn lift(&self) -> QueryInfo<QueryStackFrameExtra> {
31+
QueryInfo { span: self.span, query: self.query.lift() }
3532
}
3633
}
3734

@@ -628,7 +625,7 @@ pub fn print_query_stack<'tcx, Qcx: QueryContext<'tcx>>(
628625
let Some(query_info) = query_map.get(&query) else {
629626
break;
630627
};
631-
let query_extra = qcx.lift_query_info(&query_info.query.info);
628+
let query_extra = query_info.query.info.extract();
632629
if Some(count_printed) < limit_frames || limit_frames.is_none() {
633630
// Only print to stderr as many stack frames as `num_frames` when present.
634631
dcx.struct_failure_note(format!(

compiler/rustc_query_system/src/query/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ impl<'tcx> QueryStackFrame<QueryStackDeferred<'tcx>> {
7070
Self { info, def_id, dep_kind, hash, def_id_for_ty_in_cycle }
7171
}
7272

73-
fn lift<Qcx: QueryContext<'tcx>>(&self, qcx: Qcx) -> QueryStackFrame<QueryStackFrameExtra> {
73+
fn lift(&self) -> QueryStackFrame<QueryStackFrameExtra> {
7474
QueryStackFrame {
75-
info: qcx.lift_query_info(&self.info),
75+
info: self.info.extract(),
7676
dep_kind: self.dep_kind,
7777
hash: self.hash,
7878
def_id: self.def_id,
@@ -168,8 +168,6 @@ pub trait QueryContext<'tcx>: HasDepContext {
168168

169169
fn collect_active_jobs(self, require_complete: bool) -> Result<QueryMap<'tcx>, QueryMap<'tcx>>;
170170

171-
fn lift_query_info(self, info: &QueryStackDeferred<'tcx>) -> QueryStackFrameExtra;
172-
173171
/// Load a side effect associated to the node in the previous session.
174172
fn load_side_effect(
175173
self,

compiler/rustc_query_system/src/query/plumbing.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,10 @@ pub struct CycleError<I = QueryStackFrameExtra> {
253253
}
254254

255255
impl<'tcx> CycleError<QueryStackDeferred<'tcx>> {
256-
fn lift<Qcx: QueryContext<'tcx>>(&self, qcx: Qcx) -> CycleError<QueryStackFrameExtra> {
256+
fn lift(&self) -> CycleError<QueryStackFrameExtra> {
257257
CycleError {
258-
usage: self.usage.as_ref().map(|(span, frame)| (*span, frame.lift(qcx))),
259-
cycle: self.cycle.iter().map(|info| info.lift(qcx)).collect(),
258+
usage: self.usage.as_ref().map(|(span, frame)| (*span, frame.lift())),
259+
cycle: self.cycle.iter().map(|info| info.lift()).collect(),
260260
}
261261
}
262262
}
@@ -297,7 +297,7 @@ where
297297
let query_map = qcx.collect_active_jobs(false).ok().expect("failed to collect active queries");
298298

299299
let error = try_execute.find_cycle_in_stack(query_map, &qcx.current_query_job(), span);
300-
(mk_cycle(query, qcx, error.lift(qcx)), None)
300+
(mk_cycle(query, qcx, error.lift()), None)
301301
}
302302

303303
#[inline(always)]
@@ -345,7 +345,7 @@ where
345345

346346
(v, Some(index))
347347
}
348-
Err(cycle) => (mk_cycle(query, qcx, cycle.lift(qcx)), None),
348+
Err(cycle) => (mk_cycle(query, qcx, cycle.lift()), None),
349349
}
350350
}
351351

0 commit comments

Comments
 (0)