pub trait QueryDispatcher<'tcx>: Copy {
type Qcx: QueryContext<'tcx>;
type Key: DepNodeParams<<<This as QueryDispatcher<'tcx>>::Qcx as HasDepContext>::DepContext> + Eq + Hash + Copy + Debug;
type Value: Copy;
type Cache: QueryCache<Key = Self::Key, Value = Self::Value>;
Show 18 methods
// Required methods
fn name(self) -> &'static str;
fn format_value(self) -> fn(&Self::Value) -> String;
fn query_state<'a>(self, tcx: Self::Qcx) -> &'a QueryState<'tcx, Self::Key>;
fn query_cache<'a>(self, tcx: Self::Qcx) -> &'a Self::Cache;
fn will_cache_on_disk_for_key(
self,
tcx: <<This as QueryDispatcher<'tcx>>::Qcx as HasDepContext>::DepContext,
key: &Self::Key,
) -> bool;
fn execute_query(
self,
tcx: <<This as QueryDispatcher<'tcx>>::Qcx as HasDepContext>::DepContext,
k: Self::Key,
) -> Self::Value;
fn compute(self, tcx: Self::Qcx, key: Self::Key) -> Self::Value;
fn try_load_from_disk(
self,
tcx: Self::Qcx,
key: &Self::Key,
prev_index: SerializedDepNodeIndex,
index: DepNodeIndex,
) -> Option<Self::Value>;
fn is_loadable_from_disk(
self,
qcx: Self::Qcx,
key: &Self::Key,
idx: SerializedDepNodeIndex,
) -> bool;
fn value_from_cycle_error(
self,
tcx: <<This as QueryDispatcher<'tcx>>::Qcx as HasDepContext>::DepContext,
cycle_error: &CycleError<QueryStackFrameExtra>,
guar: ErrorGuaranteed,
) -> Self::Value;
fn anon(self) -> bool;
fn eval_always(self) -> bool;
fn depth_limit(self) -> bool;
fn feedable(self) -> bool;
fn dep_kind(self) -> DepKind;
fn cycle_error_handling(self) -> CycleErrorHandling;
fn hash_result(self) -> HashResult<Self::Value>;
// Provided method
fn construct_dep_node(
self,
tcx: <<This as QueryDispatcher<'tcx>>::Qcx as HasDepContext>::DepContext,
key: &Self::Key,
) -> DepNode { ... }
}Expand description
Trait that can be used as a vtable for a single query, providing operations and metadata for that query.
Implemented by rustc_query_impl::SemiDynamicQueryDispatcher, which
mostly delegates to rustc_middle::query::plumbing::QueryVTable.
Those types are not visible from this rustc_query_system crate.
“Dispatcher” should be understood as a near-synonym of “vtable”.
Required Associated Types§
Sourcetype Qcx: QueryContext<'tcx>
type Qcx: QueryContext<'tcx>
Query context used by this dispatcher, i.e. rustc_query_impl::QueryCtxt.
type Key: DepNodeParams<<<This as QueryDispatcher<'tcx>>::Qcx as HasDepContext>::DepContext> + Eq + Hash + Copy + Debug
type Value: Copy
type Cache: QueryCache<Key = Self::Key, Value = Self::Value>
Required Methods§
fn name(self) -> &'static str
fn format_value(self) -> fn(&Self::Value) -> String
fn query_state<'a>(self, tcx: Self::Qcx) -> &'a QueryState<'tcx, Self::Key>
fn query_cache<'a>(self, tcx: Self::Qcx) -> &'a Self::Cache
fn will_cache_on_disk_for_key( self, tcx: <<This as QueryDispatcher<'tcx>>::Qcx as HasDepContext>::DepContext, key: &Self::Key, ) -> bool
fn execute_query( self, tcx: <<This as QueryDispatcher<'tcx>>::Qcx as HasDepContext>::DepContext, k: Self::Key, ) -> Self::Value
fn compute(self, tcx: Self::Qcx, key: Self::Key) -> Self::Value
fn try_load_from_disk( self, tcx: Self::Qcx, key: &Self::Key, prev_index: SerializedDepNodeIndex, index: DepNodeIndex, ) -> Option<Self::Value>
fn is_loadable_from_disk( self, qcx: Self::Qcx, key: &Self::Key, idx: SerializedDepNodeIndex, ) -> bool
Sourcefn value_from_cycle_error(
self,
tcx: <<This as QueryDispatcher<'tcx>>::Qcx as HasDepContext>::DepContext,
cycle_error: &CycleError<QueryStackFrameExtra>,
guar: ErrorGuaranteed,
) -> Self::Value
fn value_from_cycle_error( self, tcx: <<This as QueryDispatcher<'tcx>>::Qcx as HasDepContext>::DepContext, cycle_error: &CycleError<QueryStackFrameExtra>, guar: ErrorGuaranteed, ) -> Self::Value
Synthesize an error value to let compilation continue after a cycle.
fn anon(self) -> bool
fn eval_always(self) -> bool
fn depth_limit(self) -> bool
fn feedable(self) -> bool
fn dep_kind(self) -> DepKind
fn cycle_error_handling(self) -> CycleErrorHandling
fn hash_result(self) -> HashResult<Self::Value>
Provided Methods§
fn construct_dep_node( self, tcx: <<This as QueryDispatcher<'tcx>>::Qcx as HasDepContext>::DepContext, key: &Self::Key, ) -> DepNode
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.