Struct rustc_trait_selection::solve::search_graph::SearchGraph
source · pub(super) struct SearchGraph<'tcx> {
stack: IndexVec<StackDepth, StackElem<'tcx>>,
overflow_data: OverflowData,
provisional_cache: ProvisionalCache<'tcx>,
}Fields§
§stack: IndexVec<StackDepth, StackElem<'tcx>>The stack of goals currently being computed.
An element is deeper in the stack if its index is lower.
overflow_data: OverflowData§provisional_cache: ProvisionalCache<'tcx>Implementations§
source§impl<'tcx> SearchGraph<'tcx>
impl<'tcx> SearchGraph<'tcx>
pub fn deal_with_overflow( &mut self, tcx: TyCtxt<'tcx>, goal: Canonical<'tcx, impl Sized> ) -> QueryResult<'tcx>
source§impl<'tcx> SearchGraph<'tcx>
impl<'tcx> SearchGraph<'tcx>
pub(super) fn new(tcx: TyCtxt<'tcx>) -> SearchGraph<'tcx>
pub(super) fn is_empty(&self) -> bool
sourcepub(super) fn in_cycle(&self) -> bool
pub(super) fn in_cycle(&self) -> bool
Whether we’re currently in a cycle. This should only be used for debug assertions.
sourcefn try_push_stack(
&mut self,
tcx: TyCtxt<'tcx>,
goal: CanonicalGoal<'tcx>
) -> Result<(), QueryResult<'tcx>>
fn try_push_stack( &mut self, tcx: TyCtxt<'tcx>, goal: CanonicalGoal<'tcx> ) -> Result<(), QueryResult<'tcx>>
Tries putting the new goal on the stack, returning an error if it is already cached.
This correctly updates the provisional cache if there is a cycle.
sourcefn try_finalize_goal(
&mut self,
actual_goal: CanonicalGoal<'tcx>,
response: QueryResult<'tcx>
) -> bool
fn try_finalize_goal( &mut self, actual_goal: CanonicalGoal<'tcx>, response: QueryResult<'tcx> ) -> bool
We cannot simply store the result of super::EvalCtxt::compute_goal as we have to deal with coinductive cycles.
When we encounter a coinductive cycle, we have to prove the final result of that cycle while we are still computing that result. Because of this we continously recompute the cycle until the result of the previous iteration is equal to the final result, at which point we are done.
This function returns true if we were able to finalize the goal and false if it has
updated the provisional cache and we have to recompute the current goal.
FIXME: Refer to the rustc-dev-guide entry once it exists.
pub(super) fn with_new_goal( &mut self, tcx: TyCtxt<'tcx>, canonical_goal: CanonicalGoal<'tcx>, loop_body: impl FnMut(&mut Self) -> QueryResult<'tcx> ) -> QueryResult<'tcx>
Trait Implementations§
source§impl<'tcx> OverflowHandler<'tcx> for SearchGraph<'tcx>
impl<'tcx> OverflowHandler<'tcx> for SearchGraph<'tcx>
fn search_graph(&mut self) -> &mut SearchGraph<'tcx>
fn repeat_while_none<T>( &mut self, on_overflow: impl FnOnce(&mut Self) -> Result<T, NoSolution>, loop_body: impl FnMut(&mut Self) -> Option<Result<T, NoSolution>> ) -> Result<T, NoSolution>
Auto Trait Implementations§
impl<'tcx> !RefUnwindSafe for SearchGraph<'tcx>
impl<'tcx> !Send for SearchGraph<'tcx>
impl<'tcx> !Sync for SearchGraph<'tcx>
impl<'tcx> Unpin for SearchGraph<'tcx>
impl<'tcx> !UnwindSafe for SearchGraph<'tcx>
Blanket Implementations§
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: 104 bytes