rustc_data_structures::obligation_forest

Trait ObligationProcessor

source
pub trait ObligationProcessor {
    type Obligation: ForestObligation;
    type Error: Debug;
    type OUT: OutcomeTrait<Obligation = Self::Obligation, Error = Error<Self::Obligation, Self::Error>>;

    // Required methods
    fn needs_process_obligation(&self, _obligation: &Self::Obligation) -> bool;
    fn process_obligation(
        &mut self,
        obligation: &mut Self::Obligation,
    ) -> ProcessResult<Self::Obligation, Self::Error>;
    fn process_backedge<'c, I>(
        &mut self,
        cycle: I,
        _marker: PhantomData<&'c Self::Obligation>,
    ) -> Result<(), Self::Error>
       where I: Clone + Iterator<Item = &'c Self::Obligation>;

    // Provided method
    fn skippable_obligations<'a>(
        &'a self,
        _it: impl Iterator<Item = &'a Self::Obligation>,
    ) -> usize { ... }
}

Required Associated Types§

source

type Obligation: ForestObligation

source

type Error: Debug

source

type OUT: OutcomeTrait<Obligation = Self::Obligation, Error = Error<Self::Obligation, Self::Error>>

Required Methods§

source

fn needs_process_obligation(&self, _obligation: &Self::Obligation) -> bool

source

fn process_obligation( &mut self, obligation: &mut Self::Obligation, ) -> ProcessResult<Self::Obligation, Self::Error>

source

fn process_backedge<'c, I>( &mut self, cycle: I, _marker: PhantomData<&'c Self::Obligation>, ) -> Result<(), Self::Error>
where I: Clone + Iterator<Item = &'c Self::Obligation>,

As we do the cycle check, we invoke this callback when we encounter an actual cycle. cycle is an iterator that starts at the start of the cycle in the stack and walks toward the top.

In other words, if we had O1 which required O2 which required O3 which required O1, we would give an iterator yielding O1, O2, O3 (O1 is not yielded twice).

Provided Methods§

source

fn skippable_obligations<'a>( &'a self, _it: impl Iterator<Item = &'a Self::Obligation>, ) -> usize

Implementations can provide a fast-path to obligation-processing by counting the prefix of the passed iterator for which needs_process_obligation would return false.

Object Safety§

This trait is not object safe.

Implementors§