rustc_infer::traits

Type Alias PredicateObligation

Source
pub type PredicateObligation<'tcx> = Obligation<'tcx, Predicate<'tcx>>;

Aliased Type§

struct PredicateObligation<'tcx> {
    pub cause: ObligationCause<'tcx>,
    pub param_env: ParamEnv<'tcx>,
    pub predicate: Predicate<'tcx>,
    pub recursion_depth: usize,
}

Fields§

§cause: ObligationCause<'tcx>

The reason we have to prove this thing.

§param_env: ParamEnv<'tcx>

The environment in which we should prove this thing.

§predicate: Predicate<'tcx>

The thing we are trying to prove.

§recursion_depth: usize

If we started proving this as a result of trying to prove something else, track the total depth to ensure termination. If this goes over a certain threshold, we abort compilation – in such cases, we can not say whether or not the predicate holds for certain. Stupid halting problem; such a drag.

Implementations§

Source§

impl<'tcx> PredicateObligation<'tcx>

Source

pub fn flip_polarity( &self, tcx: TyCtxt<'tcx>, ) -> Option<PredicateObligation<'tcx>>

Flips the polarity of the inner predicate.

Given T: Trait predicate it returns T: !Trait and given T: !Trait returns T: Trait.

Trait Implementations§

Source§

impl<'tcx> Elaboratable<TyCtxt<'tcx>> for PredicateObligation<'tcx>

For Obligation, a sub-obligation is combined with the current obligation’s param-env and cause code.

Source§

fn predicate(&self) -> Predicate<'tcx>

Source§

fn child(&self, clause: Clause<'tcx>) -> Self

Source§

fn child_with_derived_cause( &self, clause: Clause<'tcx>, span: Span, parent_trait_pred: PolyTraitPredicate<'tcx>, index: usize, ) -> Self

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