[][src]Struct rustc_infer::traits::Obligation

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

An Obligation represents some trait reference (e.g., i32: Eq) for which the "impl_source" must be found. The process of finding a "impl_source" is called "resolving" the Obligation. This process consists of either identifying an impl (e.g., impl Eq for i32) that satisfies the obligation, or else finding a bound that is in scope. The eventual result is usually a Selection (defined below).

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: T

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

impl<'tcx, O> Obligation<'tcx, O>[src]

pub fn new(
    cause: ObligationCause<'tcx>,
    param_env: ParamEnv<'tcx>,
    predicate: O
) -> Obligation<'tcx, O>
[src]

pub fn with_depth(
    cause: ObligationCause<'tcx>,
    recursion_depth: usize,
    param_env: ParamEnv<'tcx>,
    predicate: O
) -> Obligation<'tcx, O>
[src]

pub fn misc(
    span: Span,
    body_id: HirId,
    param_env: ParamEnv<'tcx>,
    trait_ref: O
) -> Obligation<'tcx, O>
[src]

pub fn with<P>(&self, value: P) -> Obligation<'tcx, P>[src]

impl<'tcx> Obligation<'tcx, Binder<TraitPredicate<'tcx>>>[src]

pub fn self_ty(&self) -> Binder<Ty<'tcx>>[src]

Trait Implementations

impl<'tcx, T: Clone> Clone for Obligation<'tcx, T>[src]

impl<'tcx, O: Debug> Debug for Obligation<'tcx, O>[src]

impl<'tcx, T: Eq> Eq for Obligation<'tcx, T>[src]

impl<'tcx, T: Hash> Hash for Obligation<'tcx, T>[src]

impl<'tcx, T: PartialEq> PartialEq<Obligation<'tcx, T>> for Obligation<'tcx, T>[src]

impl<'tcx, T> StructuralEq for Obligation<'tcx, T>[src]

impl<'tcx, T> StructuralPartialEq for Obligation<'tcx, T>[src]

impl<'tcx, O: TypeFoldable<'tcx>> TypeFoldable<'tcx> for Obligation<'tcx, O>[src]

Auto Trait Implementations

impl<'tcx, T> !RefUnwindSafe for Obligation<'tcx, T>

impl<'tcx, T> !Send for Obligation<'tcx, T>

impl<'tcx, T> !Sync for Obligation<'tcx, T>

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

impl<'tcx, T> !UnwindSafe for Obligation<'tcx, T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<'a, T> Captures<'a> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<'tcx, T> Subst<'tcx> for T where
    T: TypeFoldable<'tcx>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> WithConstness for T[src]