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 try_push_stack(
&mut self,
tcx: TyCtxt<'tcx>,
goal: Canonical<'tcx, Goal<'tcx, Predicate<'tcx>>>
) -> Result<(), QueryResult<'tcx>>
pub(super) fn try_push_stack(
&mut self,
tcx: TyCtxt<'tcx>,
goal: Canonical<'tcx, Goal<'tcx, Predicate<'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.
sourcepub(super) fn try_finalize_goal(
&mut self,
tcx: TyCtxt<'tcx>,
actual_goal: Canonical<'tcx, Goal<'tcx, Predicate<'tcx>>>,
response: QueryResult<'tcx>
) -> bool
pub(super) fn try_finalize_goal(
&mut self,
tcx: TyCtxt<'tcx>,
actual_goal: Canonical<'tcx, Goal<'tcx, Predicate<'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.
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