Skip to content

Commit 29eb8ff

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

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
@@ -129,7 +129,7 @@ pub trait QueryContext: HasDepContext {
129129
token: QueryJobId,
130130
depth_limit: bool,
131131
diagnostics: Option<&Lock<ThinVec<Diagnostic>>>,
132-
compute: &mut dyn FnMut() -> R,
132+
compute: impl FnOnce() -> R,
133133
) -> R;
134134

135135
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
@@ -418,7 +418,7 @@ where
418418
}
419419

420420
let prof_timer = qcx.dep_context().profiler().query_provider();
421-
let result = qcx.start_query(job_id, Q::DEPTH_LIMIT, None, &mut || Q::compute(qcx, key));
421+
let result = qcx.start_query(job_id, Q::DEPTH_LIMIT, None, || Q::compute(qcx, key));
422422
let dep_node_index = dep_graph.next_virtual_depnode_index();
423423
prof_timer.finish_with_query_invocation_id(dep_node_index.into());
424424

@@ -442,7 +442,7 @@ where
442442

443443
// The diagnostics for this query will be promoted to the current session during
444444
// `try_mark_green()`, so we can ignore them here.
445-
if let Some(ret) = qcx.start_query(job_id, false, None, &mut || {
445+
if let Some(ret) = qcx.start_query(job_id, false, None, || {
446446
try_load_from_disk_and_cache_in_memory::<Q, Qcx>(qcx, &key, &dep_node)
447447
}) {
448448
return ret;
@@ -453,7 +453,7 @@ where
453453
let diagnostics = Lock::new(ThinVec::new());
454454

455455
let (result, dep_node_index) =
456-
qcx.start_query(job_id, Q::DEPTH_LIMIT, Some(&diagnostics), &mut || {
456+
qcx.start_query(job_id, Q::DEPTH_LIMIT, Some(&diagnostics), || {
457457
if Q::ANON {
458458
return dep_graph
459459
.with_anon_task(*qcx.dep_context(), Q::DEP_KIND, || Q::compute(qcx, key));

0 commit comments

Comments
 (0)