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.

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

Implementations

Source§

impl<'tcx, O> Obligation<'tcx, O>

Source

pub fn new( tcx: TyCtxt<'tcx>, cause: ObligationCause<'tcx>, param_env: ParamEnv<'tcx>, predicate: impl Upcast<TyCtxt<'tcx>, O>, ) -> Obligation<'tcx, O>

Source

pub fn set_depth_from_parent(&mut self, parent_depth: usize)

We often create nested obligations without setting the correct depth.

To deal with this evaluate and fulfill explicitly update the depth of nested obligations using this function.

Source

pub fn with_depth( tcx: TyCtxt<'tcx>, cause: ObligationCause<'tcx>, recursion_depth: usize, param_env: ParamEnv<'tcx>, predicate: impl Upcast<TyCtxt<'tcx>, O>, ) -> Obligation<'tcx, O>

Source

pub fn misc( tcx: TyCtxt<'tcx>, span: Span, body_id: LocalDefId, param_env: ParamEnv<'tcx>, trait_ref: impl Upcast<TyCtxt<'tcx>, O>, ) -> Obligation<'tcx, O>

Source

pub fn with<P>( &self, tcx: TyCtxt<'tcx>, value: impl Upcast<TyCtxt<'tcx>, P>, ) -> Obligation<'tcx, P>

Source§

impl<'tcx> Obligation<'tcx, Predicate<'tcx>>

Source

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

Flips the polarity of the inner predicate.

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

Source§

impl<'tcx, T> Obligation<'tcx, T>
where T: Copy,

Source

pub fn as_goal(&self) -> Goal<TyCtxt<'tcx>, T>

Trait Implementations

Source§

impl<'tcx, T> Clone for Obligation<'tcx, T>
where T: Clone,

Source§

fn clone(&self) -> Obligation<'tcx, T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'tcx, O> Debug for Obligation<'tcx, O>
where O: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'tcx> Elaboratable<TyCtxt<'tcx>> for Obligation<'tcx, Predicate<'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>) -> Obligation<'tcx, Predicate<'tcx>>

Source§

fn child_with_derived_cause( &self, clause: Clause<'tcx>, span: Span, parent_trait_pred: Binder<TyCtxt<'tcx>, TraitPredicate<TyCtxt<'tcx>>>, index: usize, ) -> Obligation<'tcx, Predicate<'tcx>>

Source§

impl<T> Hash for Obligation<'_, T>
where T: Hash,

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'tcx, T> PartialEq for Obligation<'tcx, T>
where T: PartialEq,

Source§

fn eq(&self, other: &Obligation<'tcx, T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'tcx, T> TypeFoldable<TyCtxt<'tcx>> for Obligation<'tcx, T>
where T: TypeFoldable<TyCtxt<'tcx>>,

Source§

fn try_fold_with<__F>( self, __folder: &mut __F, ) -> Result<Obligation<'tcx, T>, <__F as FallibleTypeFolder<TyCtxt<'tcx>>>::Error>
where __F: FallibleTypeFolder<TyCtxt<'tcx>>,

The entry point for folding. To fold a value t with a folder f call: t.try_fold_with(f). Read more
Source§

fn fold_with<__F>(self, __folder: &mut __F) -> Obligation<'tcx, T>
where __F: TypeFolder<TyCtxt<'tcx>>,

The entry point for folding. To fold a value t with a folder f call: t.fold_with(f). Read more
Source§

impl<'tcx, T> TypeVisitable<TyCtxt<'tcx>> for Obligation<'tcx, T>
where T: TypeVisitable<TyCtxt<'tcx>>,

Source§

fn visit_with<__V>( &self, __visitor: &mut __V, ) -> <__V as TypeVisitor<TyCtxt<'tcx>>>::Result
where __V: TypeVisitor<TyCtxt<'tcx>>,

The entry point for visiting. To visit a value t with a visitor v call: t.visit_with(v). Read more
Source§

impl<T> Eq for Obligation<'_, T>
where T: Eq,