From d4598406336a1100786ff15708b48a51768ec235 Mon Sep 17 00:00:00 2001 From: =?utf8?q?John=20K=C3=A5re=20Alsaker?= Date: Fri, 3 Feb 2023 19:13:45 +0100 Subject: [PATCH] Remove QueryStorage::store_nocache --- .../rustc_query_system/src/query/caches.rs | 30 ------------------- .../rustc_query_system/src/query/plumbing.rs | 11 +++---- 2 files changed, 4 insertions(+), 37 deletions(-) diff --git a/compiler/rustc_query_system/src/query/caches.rs b/compiler/rustc_query_system/src/query/caches.rs index 21c89cbc4f1..9f875b43731 100644 --- a/compiler/rustc_query_system/src/query/caches.rs +++ b/compiler/rustc_query_system/src/query/caches.rs @@ -23,10 +23,6 @@ pub trait CacheSelector<'tcx, V> { pub trait QueryStorage { type Value: Debug; type Stored: Copy; - - /// Store a value without putting it in the cache. - /// This is meant to be used with cycle errors. - fn store_nocache(&self, value: Self::Value) -> Self::Stored; } pub trait QueryCache: QueryStorage + Sized { @@ -68,12 +64,6 @@ fn default() -> Self { impl QueryStorage for DefaultCache { type Value = V; type Stored = V; - - #[inline] - fn store_nocache(&self, value: Self::Value) -> Self::Stored { - // We have no dedicated storage - value - } } impl QueryCache for DefaultCache @@ -144,13 +134,6 @@ fn default() -> Self { impl<'tcx, K: Eq + Hash, V: Debug + 'tcx> QueryStorage for ArenaCache<'tcx, K, V> { type Value = V; type Stored = &'tcx V; - - #[inline] - fn store_nocache(&self, value: Self::Value) -> Self::Stored { - let value = self.arena.alloc((value, DepNodeIndex::INVALID)); - let value = unsafe { &*(&value.0 as *const _) }; - &value - } } impl<'tcx, K, V: 'tcx> QueryCache for ArenaCache<'tcx, K, V> @@ -231,12 +214,6 @@ fn default() -> Self { impl QueryStorage for VecCache { type Value = V; type Stored = V; - - #[inline] - fn store_nocache(&self, value: Self::Value) -> Self::Stored { - // We have no dedicated storage - value - } } impl QueryCache for VecCache @@ -309,13 +286,6 @@ fn default() -> Self { impl<'tcx, K: Eq + Idx, V: Debug + 'tcx> QueryStorage for VecArenaCache<'tcx, K, V> { type Value = V; type Stored = &'tcx V; - - #[inline] - fn store_nocache(&self, value: Self::Value) -> Self::Stored { - let value = self.arena.alloc((value, DepNodeIndex::INVALID)); - let value = unsafe { &*(&value.0 as *const _) }; - &value - } } impl<'tcx, K, V: 'tcx> QueryCache for VecArenaCache<'tcx, K, V> diff --git a/compiler/rustc_query_system/src/query/plumbing.rs b/compiler/rustc_query_system/src/query/plumbing.rs index ffc413d15f5..638336224ef 100644 --- a/compiler/rustc_query_system/src/query/plumbing.rs +++ b/compiler/rustc_query_system/src/query/plumbing.rs @@ -121,20 +121,17 @@ struct JobOwner<'tcx, K, D: DepKind> #[cold] #[inline(never)] -fn mk_cycle( +fn mk_cycle( qcx: Qcx, cycle_error: CycleError, handler: HandleCycleError, - cache: &dyn crate::query::QueryStorage, ) -> R where Qcx: QueryContext + crate::query::HasDepContext, - V: std::fmt::Debug + Value, - R: Copy, + R: std::fmt::Debug + Value, { let error = report_cycle(qcx.dep_context().sess(), &cycle_error); - let value = handle_cycle_error(*qcx.dep_context(), &cycle_error, error, handler); - cache.store_nocache(value) + handle_cycle_error(*qcx.dep_context(), &cycle_error, error, handler) } fn handle_cycle_error( @@ -399,7 +396,7 @@ fn try_execute_query( (result, Some(dep_node_index)) } TryGetJob::Cycle(error) => { - let result = mk_cycle(qcx, error, Q::HANDLE_CYCLE_ERROR, cache); + let result = mk_cycle(qcx, error, Q::HANDLE_CYCLE_ERROR); (result, None) } #[cfg(parallel_compiler)] -- 2.44.0