From 279063d6a14269c94d56258fd411f4059643e20a Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Thu, 2 Feb 2023 05:34:10 +0000 Subject: [PATCH] try using a non-generic closure in `start_query` --- compiler/rustc_query_impl/src/plumbing.rs | 2 +- compiler/rustc_query_system/src/query/mod.rs | 2 +- compiler/rustc_query_system/src/query/plumbing.rs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs index a8592bd70862c..329e8200b25de 100644 --- a/compiler/rustc_query_impl/src/plumbing.rs +++ b/compiler/rustc_query_impl/src/plumbing.rs @@ -104,7 +104,7 @@ impl QueryContext for QueryCtxt<'_> { token: QueryJobId, depth_limit: bool, diagnostics: Option<&Lock>>, - compute: impl FnOnce() -> R, + compute: &mut dyn FnMut() -> R, ) -> R { // The `TyCtxt` stored in TLS has the same global interner lifetime // as `self`, so we use `with_related_context` to relate the 'tcx lifetimes diff --git a/compiler/rustc_query_system/src/query/mod.rs b/compiler/rustc_query_system/src/query/mod.rs index 383c63cd2f8a7..a9f1607862871 100644 --- a/compiler/rustc_query_system/src/query/mod.rs +++ b/compiler/rustc_query_system/src/query/mod.rs @@ -129,7 +129,7 @@ pub trait QueryContext: HasDepContext { token: QueryJobId, depth_limit: bool, diagnostics: Option<&Lock>>, - compute: impl FnOnce() -> R, + compute: &mut dyn FnMut() -> R, ) -> R; fn depth_limit_error(self, job: QueryJobId); diff --git a/compiler/rustc_query_system/src/query/plumbing.rs b/compiler/rustc_query_system/src/query/plumbing.rs index 5f003fa70e133..44c0c73cb900f 100644 --- a/compiler/rustc_query_system/src/query/plumbing.rs +++ b/compiler/rustc_query_system/src/query/plumbing.rs @@ -418,7 +418,7 @@ where } let prof_timer = qcx.dep_context().profiler().query_provider(); - let result = qcx.start_query(job_id, Q::DEPTH_LIMIT, None, || Q::compute(qcx, key)); + let result = qcx.start_query(job_id, Q::DEPTH_LIMIT, None, &mut || Q::compute(qcx, key)); let dep_node_index = dep_graph.next_virtual_depnode_index(); prof_timer.finish_with_query_invocation_id(dep_node_index.into()); @@ -442,7 +442,7 @@ where // The diagnostics for this query will be promoted to the current session during // `try_mark_green()`, so we can ignore them here. - if let Some(ret) = qcx.start_query(job_id, false, None, || { + if let Some(ret) = qcx.start_query(job_id, false, None, &mut || { try_load_from_disk_and_cache_in_memory::(qcx, &key, &dep_node) }) { return ret; @@ -453,7 +453,7 @@ where let diagnostics = Lock::new(ThinVec::new()); let (result, dep_node_index) = - qcx.start_query(job_id, Q::DEPTH_LIMIT, Some(&diagnostics), || { + qcx.start_query(job_id, Q::DEPTH_LIMIT, Some(&diagnostics), &mut || { if Q::ANON { return dep_graph .with_anon_task(*qcx.dep_context(), Q::DEP_KIND, || Q::compute(qcx, key));