pub(super) struct SearchGraph<'tcx> {
    mode: SolverMode,
    stack: IndexVec<StackDepth, StackElem<'tcx>>,
    overflow_data: OverflowData,
    provisional_cache: ProvisionalCache<'tcx>,
}

Fields§

§mode: SolverMode§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>

source

pub fn deal_with_overflow( &mut self, tcx: TyCtxt<'tcx>, goal: Canonical<'tcx, impl Sized> ) -> QueryResult<'tcx>

source§

impl<'tcx> SearchGraph<'tcx>

source

pub(super) fn new(tcx: TyCtxt<'tcx>, mode: SolverMode) -> SearchGraph<'tcx>

source

pub(super) fn solver_mode(&self) -> SolverMode

source

pub(super) fn should_use_global_cache(&self) -> bool

We do not use the global cache during coherence.

The trait solver behavior is different for coherence so we would have to add the solver mode to the cache key. This is probably not worth it as trait solving during coherence tends to already be incredibly fast.

We could add another global cache for coherence instead, but that’s effort so let’s only do it if necessary.

source

pub(super) fn is_empty(&self) -> bool

source

pub(super) fn in_cycle(&self) -> bool

Whether we’re currently in a cycle. This should only be used for debug assertions.

source

fn try_push_stack( &mut self, tcx: TyCtxt<'tcx>, input: CanonicalInput<'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.

source

fn try_finalize_goal( &mut self, actual_input: CanonicalInput<'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 continuously 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.

source

pub(super) fn with_new_goal( &mut self, tcx: TyCtxt<'tcx>, canonical_input: CanonicalInput<'tcx>, loop_body: impl FnMut(&mut Self) -> QueryResult<'tcx> ) -> QueryResult<'tcx>

Trait Implementations§

source§

impl<'tcx> OverflowHandler<'tcx> for SearchGraph<'tcx>

source§

fn search_graph(&mut self) -> &mut SearchGraph<'tcx>

source§

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>

source§

fn with_incremented_depth<T>( &mut self, on_overflow: impl FnOnce(&mut Self) -> T, body: impl FnOnce(&mut Self) -> T ) -> T

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§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

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:112 bytes