Skip to content

Commit 390fd19

Browse files
committed
Revert "try using a non-generic closure in start_query"
This reverts commit 279063d.
1 parent afa569d commit 390fd19

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

compiler/rustc_query_impl/src/plumbing.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ impl QueryContext for QueryCtxt<'_> {
104104
token: QueryJobId,
105105
depth_limit: bool,
106106
diagnostics: Option<&Lock<ThinVec<Diagnostic>>>,
107-
compute: &mut dyn FnMut() -> R,
107+
compute: impl FnOnce() -> R,
108108
) -> R {
109109
// The `TyCtxt` stored in TLS has the same global interner lifetime
110110
// as `self`, so we use `with_related_context` to relate the 'tcx lifetimes

compiler/rustc_query_system/src/query/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ pub trait QueryContext: HasDepContext {
128128
token: QueryJobId,
129129
depth_limit: bool,
130130
diagnostics: Option<&Lock<ThinVec<Diagnostic>>>,
131-
compute: &mut dyn FnMut() -> R,
131+
compute: impl FnOnce() -> R,
132132
) -> R;
133133

134134
fn depth_limit_error(self, job: QueryJobId);

compiler/rustc_query_system/src/query/plumbing.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ where
421421
}
422422

423423
let prof_timer = qcx.dep_context().profiler().query_provider();
424-
let result = qcx.start_query(job_id, query.depth_limit(), None, &mut || query.compute(qcx, key));
424+
let result = qcx.start_query(job_id, query.depth_limit(), None, || query.compute(qcx, key));
425425
let dep_node_index = dep_graph.next_virtual_depnode_index();
426426
prof_timer.finish_with_query_invocation_id(dep_node_index.into());
427427

@@ -445,7 +445,7 @@ where
445445

446446
// The diagnostics for this query will be promoted to the current session during
447447
// `try_mark_green()`, so we can ignore them here.
448-
if let Some(ret) = qcx.start_query(job_id, false, None, &mut || {
448+
if let Some(ret) = qcx.start_query(job_id, false, None, || {
449449
try_load_from_disk_and_cache_in_memory(query, qcx, &key, &dep_node)
450450
}) {
451451
return ret;
@@ -456,7 +456,7 @@ where
456456
let diagnostics = Lock::new(ThinVec::new());
457457

458458
let (result, dep_node_index) =
459-
qcx.start_query(job_id, query.depth_limit(), Some(&diagnostics), &mut || {
459+
qcx.start_query(job_id, query.depth_limit(), Some(&diagnostics), || {
460460
if query.anon() {
461461
return dep_graph.with_anon_task(*qcx.dep_context(), query.dep_kind(), || {
462462
query.compute(qcx, key)

0 commit comments

Comments
 (0)