Struct rustc_next_trait_solver::solve::search_graph::SearchGraph
source · pub(super) struct SearchGraph<I: Interner> {
mode: SolverMode,
stack: IndexVec<StackDepth, StackEntry<I>>,
provisional_cache: HashMap<CanonicalInput<I>, ProvisionalCacheEntry<I>>,
}Fields§
§mode: SolverMode§stack: IndexVec<StackDepth, StackEntry<I>>The stack of goals currently being computed.
An element is deeper in the stack if its index is lower.
provisional_cache: HashMap<CanonicalInput<I>, ProvisionalCacheEntry<I>>Implementations§
source§impl<I: Interner> SearchGraph<I>
impl<I: Interner> SearchGraph<I>
pub(super) fn new(mode: SolverMode) -> SearchGraph<I>
pub(super) fn solver_mode(&self) -> SolverMode
sourcefn pop_stack(&mut self) -> StackEntry<I>
fn pop_stack(&mut self) -> StackEntry<I>
Pops the highest goal from the stack, lazily updating the the next goal in the stack.
Directly popping from the stack instead of using this method would cause us to not track overflow and recursion depth correctly.
pub(super) fn is_empty(&self) -> bool
sourcefn allowed_depth_for_nested(
tcx: I,
stack: &IndexVec<StackDepth, StackEntry<I>>,
) -> Option<SolverLimit>
fn allowed_depth_for_nested( tcx: I, stack: &IndexVec<StackDepth, StackEntry<I>>, ) -> Option<SolverLimit>
Returns the remaining depth allowed for nested goals.
This is generally simply one less than the current depth. However, if we encountered overflow, we significantly reduce the remaining depth of all nested goals to prevent hangs in case there is exponential blowup.
fn stack_coinductive_from( tcx: I, stack: &IndexVec<StackDepth, StackEntry<I>>, head: StackDepth, ) -> bool
fn tag_cycle_participants( stack: &mut IndexVec<StackDepth, StackEntry<I>>, usage_kind: HasBeenUsed, head: StackDepth, )
fn clear_dependent_provisional_results( provisional_cache: &mut HashMap<CanonicalInput<I>, ProvisionalCacheEntry<I>>, head: StackDepth, )
sourcepub(super) fn global_cache(&self, tcx: I) -> I::EvaluationCache
pub(super) fn global_cache(&self, tcx: I) -> I::EvaluationCache
The trait solver behavior is different for coherence so we use a separate cache. Alternatively we could use a single cache and share it between coherence and ordinary trait solving.
sourcepub(super) fn with_new_goal<Infcx: SolverDelegate<Interner = I>>(
&mut self,
tcx: I,
input: CanonicalInput<I>,
inspect: &mut ProofTreeBuilder<Infcx>,
prove_goal: impl FnMut(&mut Self, &mut ProofTreeBuilder<Infcx>) -> QueryResult<I>,
) -> QueryResult<I>
pub(super) fn with_new_goal<Infcx: SolverDelegate<Interner = I>>( &mut self, tcx: I, input: CanonicalInput<I>, inspect: &mut ProofTreeBuilder<Infcx>, prove_goal: impl FnMut(&mut Self, &mut ProofTreeBuilder<Infcx>) -> QueryResult<I>, ) -> QueryResult<I>
Probably the most involved method of the whole solver.
Given some goal which is proven via the prove_goal closure, this
handles caching, overflow, and coinductive cycles.
sourcefn lookup_global_cache<Infcx: SolverDelegate<Interner = I>>(
&mut self,
tcx: I,
input: CanonicalInput<I>,
available_depth: SolverLimit,
inspect: &mut ProofTreeBuilder<Infcx>,
) -> Option<QueryResult<I>>
fn lookup_global_cache<Infcx: SolverDelegate<Interner = I>>( &mut self, tcx: I, input: CanonicalInput<I>, available_depth: SolverLimit, inspect: &mut ProofTreeBuilder<Infcx>, ) -> Option<QueryResult<I>>
Try to fetch a previously computed result from the global cache, making sure to only do so if it would match the result of reevaluating this goal.
source§impl<I: Interner> SearchGraph<I>
impl<I: Interner> SearchGraph<I>
sourcefn fixpoint_step_in_task<Infcx, F>(
&mut self,
tcx: I,
input: CanonicalInput<I>,
inspect: &mut ProofTreeBuilder<Infcx>,
prove_goal: &mut F,
) -> StepResult<I>where
Infcx: SolverDelegate<Interner = I>,
F: FnMut(&mut Self, &mut ProofTreeBuilder<Infcx>) -> QueryResult<I>,
fn fixpoint_step_in_task<Infcx, F>(
&mut self,
tcx: I,
input: CanonicalInput<I>,
inspect: &mut ProofTreeBuilder<Infcx>,
prove_goal: &mut F,
) -> StepResult<I>where
Infcx: SolverDelegate<Interner = I>,
F: FnMut(&mut Self, &mut ProofTreeBuilder<Infcx>) -> QueryResult<I>,
When we encounter a coinductive cycle, we have to fetch the result of that cycle while we are still computing it. Because of this we continuously recompute the cycle until the result of the previous iteration is equal to the final result, at which point we are done.
fn response_no_constraints( tcx: I, goal: CanonicalInput<I>, certainty: Certainty, ) -> QueryResult<I>
fn check_invariants(&self)
Auto Trait Implementations§
impl<I> DynSend for SearchGraph<I>where
<I as Interner>::DefiningOpaqueTypes: DynSend,
<I as Interner>::CanonicalVars: DynSend,
<I as Interner>::PredefinedOpaques: DynSend,
<I as Interner>::ParamEnv: DynSend,
<I as Interner>::Predicate: DynSend,
<I as Interner>::ExternalConstraints: DynSend,
<I as Interner>::GenericArgs: DynSend,
impl<I> DynSync for SearchGraph<I>where
<I as Interner>::DefiningOpaqueTypes: DynSync,
<I as Interner>::CanonicalVars: DynSync,
<I as Interner>::PredefinedOpaques: DynSync,
<I as Interner>::ParamEnv: DynSync,
<I as Interner>::Predicate: DynSync,
<I as Interner>::ExternalConstraints: DynSync,
<I as Interner>::GenericArgs: DynSync,
impl<I> Freeze for SearchGraph<I>
impl<I> RefUnwindSafe for SearchGraph<I>where
<I as Interner>::DefiningOpaqueTypes: RefUnwindSafe,
<I as Interner>::CanonicalVars: RefUnwindSafe,
<I as Interner>::PredefinedOpaques: RefUnwindSafe,
<I as Interner>::ParamEnv: RefUnwindSafe,
<I as Interner>::Predicate: RefUnwindSafe,
<I as Interner>::ExternalConstraints: RefUnwindSafe,
<I as Interner>::GenericArgs: RefUnwindSafe,
impl<I> Send for SearchGraph<I>where
<I as Interner>::DefiningOpaqueTypes: Send,
<I as Interner>::CanonicalVars: Send,
<I as Interner>::PredefinedOpaques: Send,
<I as Interner>::ParamEnv: Send,
<I as Interner>::Predicate: Send,
<I as Interner>::ExternalConstraints: Send,
<I as Interner>::GenericArgs: Send,
impl<I> Sync for SearchGraph<I>where
<I as Interner>::DefiningOpaqueTypes: Sync,
<I as Interner>::CanonicalVars: Sync,
<I as Interner>::PredefinedOpaques: Sync,
<I as Interner>::ParamEnv: Sync,
<I as Interner>::Predicate: Sync,
<I as Interner>::ExternalConstraints: Sync,
<I as Interner>::GenericArgs: Sync,
impl<I> Unpin for SearchGraph<I>where
<I as Interner>::DefiningOpaqueTypes: Unpin,
<I as Interner>::CanonicalVars: Unpin,
<I as Interner>::PredefinedOpaques: Unpin,
<I as Interner>::ParamEnv: Unpin,
<I as Interner>::Predicate: Unpin,
<I as Interner>::ExternalConstraints: Unpin,
<I as Interner>::GenericArgs: Unpin,
impl<I> UnwindSafe for SearchGraph<I>where
<I as Interner>::DefiningOpaqueTypes: UnwindSafe,
<I as Interner>::CanonicalVars: UnwindSafe,
<I as Interner>::PredefinedOpaques: UnwindSafe,
<I as Interner>::ParamEnv: UnwindSafe,
<I as Interner>::Predicate: UnwindSafe,
<I as Interner>::ExternalConstraints: UnwindSafe,
<I as Interner>::GenericArgs: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
source§impl<I, T> UpcastFrom<I, T> for T
impl<I, T> UpcastFrom<I, T> for T
fn upcast_from(from: T, _tcx: I) -> T
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 64 bytes