diff --git a/examples/hello_world/compiler.rs b/examples/hello_world/compiler.rs index 5cedd221..469c231d 100644 --- a/examples/hello_world/compiler.rs +++ b/examples/hello_world/compiler.rs @@ -1,4 +1,4 @@ -pub trait CompilerQueryContext: salsa::BaseQueryContext { +pub trait CompilerQueryContext: salsa::QueryContext { fn interner(&self) -> &Interner; } diff --git a/examples/hello_world/implementation.rs b/examples/hello_world/implementation.rs index 9f88c156..405fce5f 100644 --- a/examples/hello_world/implementation.rs +++ b/examples/hello_world/implementation.rs @@ -1,7 +1,6 @@ use crate::class_table; use crate::compiler::{CompilerQueryContext, Interner}; use salsa::query_context_storage; -use salsa::BaseQueryContext; #[derive(Default)] pub struct QueryContextImpl { @@ -37,7 +36,7 @@ impl CompilerQueryContext for QueryContextImpl { // Seems like a classic case where specialization could be useful to // permit behavior refinement. -impl BaseQueryContext for QueryContextImpl { +impl salsa::QueryContext for QueryContextImpl { type QueryDescriptor = salsa::dyn_descriptor::DynDescriptor; fn salsa_runtime(&self) -> &salsa::runtime::Runtime { diff --git a/examples/storage_varieties/implementation.rs b/examples/storage_varieties/implementation.rs index 79725edd..4ca100e4 100644 --- a/examples/storage_varieties/implementation.rs +++ b/examples/storage_varieties/implementation.rs @@ -25,7 +25,7 @@ impl queries::CounterContext for QueryContextImpl { } } -impl salsa::BaseQueryContext for QueryContextImpl { +impl salsa::QueryContext for QueryContextImpl { type QueryDescriptor = salsa::dyn_descriptor::DynDescriptor; fn salsa_runtime(&self) -> &salsa::runtime::Runtime { diff --git a/examples/storage_varieties/queries.rs b/examples/storage_varieties/queries.rs index 0bfe1d83..92e54b18 100644 --- a/examples/storage_varieties/queries.rs +++ b/examples/storage_varieties/queries.rs @@ -1,4 +1,4 @@ -crate trait CounterContext: salsa::BaseQueryContext { +crate trait CounterContext: salsa::QueryContext { fn increment(&self) -> usize; } diff --git a/src/dyn_descriptor.rs b/src/dyn_descriptor.rs index 2db01b01..5217cef7 100644 --- a/src/dyn_descriptor.rs +++ b/src/dyn_descriptor.rs @@ -1,5 +1,5 @@ -use crate::BaseQueryContext; use crate::Query; +use crate::QueryContext; use crate::QueryTable; use rustc_hash::FxHashMap; use std::any::{Any, TypeId}; @@ -26,7 +26,7 @@ pub struct DynDescriptor { impl DynDescriptor { pub fn from_key(_query: &QC, key: &Q::Key) -> DynDescriptor where - QC: BaseQueryContext, + QC: QueryContext, Q: Query, { let type_id = TypeId::of::(); diff --git a/src/lib.rs b/src/lib.rs index 97f14831..7fa07ee7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -26,7 +26,7 @@ pub mod transparent; pub use self::runtime::Runtime; -pub trait BaseQueryContext: Sized { +pub trait QueryContext: Sized { /// A "query descriptor" packages up all the possible queries and a key. /// It is used to store information about (e.g.) the stack. /// @@ -39,7 +39,7 @@ pub trait BaseQueryContext: Sized { fn salsa_runtime(&self) -> &runtime::Runtime; } -pub trait Query: Debug + Default + Sized + 'static { +pub trait Query: Debug + Default + Sized + 'static { type Key: Clone + Debug + Hash + Eq + Send; type Value: Clone + Debug + Hash + Eq + Send; type Storage: QueryStorageOps + Send + Sync; @@ -49,7 +49,7 @@ pub trait Query: Debug + Default + Sized + 'static { pub trait QueryStorageOps: Default where - QC: BaseQueryContext, + QC: QueryContext, Q: Query, { fn try_fetch<'q>( @@ -63,7 +63,7 @@ where #[derive(new)] pub struct QueryTable<'me, QC, Q> where - QC: BaseQueryContext, + QC: QueryContext, Q: Query, { pub query: &'me QC, @@ -75,7 +75,7 @@ pub struct CycleDetected; impl QueryTable<'me, QC, Q> where - QC: BaseQueryContext, + QC: QueryContext, Q: Query, { pub fn of(&self, key: Q::Key) -> Q::Value { diff --git a/src/memoized.rs b/src/memoized.rs index 3107c2ec..01f4e641 100644 --- a/src/memoized.rs +++ b/src/memoized.rs @@ -1,6 +1,6 @@ -use crate::BaseQueryContext; use crate::CycleDetected; use crate::Query; +use crate::QueryContext; use crate::QueryStorageOps; use crate::QueryTable; use parking_lot::{RwLock, RwLockUpgradableReadGuard}; @@ -20,7 +20,7 @@ use std::hash::Hash; pub struct MemoizedStorage where Q: Query, - QC: BaseQueryContext, + QC: QueryContext, { map: RwLock>>, } @@ -39,7 +39,7 @@ enum QueryState { impl Default for MemoizedStorage where Q: Query, - QC: BaseQueryContext, + QC: QueryContext, { fn default() -> Self { MemoizedStorage { @@ -51,7 +51,7 @@ where impl QueryStorageOps for MemoizedStorage where Q: Query, - QC: BaseQueryContext, + QC: QueryContext, { fn try_fetch<'q>( &self, diff --git a/src/runtime.rs b/src/runtime.rs index 4bef72ca..e7b2aea2 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -1,18 +1,18 @@ -use crate::BaseQueryContext; use crate::Query; +use crate::QueryContext; use std::cell::RefCell; use std::fmt::Write; pub struct Runtime where - QC: BaseQueryContext, + QC: QueryContext, { execution_stack: RefCell>, } impl Default for Runtime where - QC: BaseQueryContext, + QC: QueryContext, { fn default() -> Self { Runtime { @@ -23,7 +23,7 @@ where impl Runtime where - QC: BaseQueryContext, + QC: QueryContext, { crate fn execute_query_implementation( &self, diff --git a/src/transparent.rs b/src/transparent.rs index c0b4fb3c..cd752ce6 100644 --- a/src/transparent.rs +++ b/src/transparent.rs @@ -1,6 +1,6 @@ -use crate::BaseQueryContext; use crate::CycleDetected; use crate::Query; +use crate::QueryContext; use crate::QueryStorageOps; use crate::QueryTable; use parking_lot::{RwLock, RwLockUpgradableReadGuard}; @@ -23,7 +23,7 @@ pub struct TransparentStorage; impl QueryStorageOps for TransparentStorage where Q: Query, - QC: BaseQueryContext, + QC: QueryContext, { fn try_fetch<'q>( &self,