Struct rustc_trait_selection::traits::Obligation [−][src]
pub struct Obligation<'tcx, T> {
pub cause: ObligationCause<'tcx>,
pub param_env: ParamEnv<'tcx>,
pub predicate: T,
pub recursion_depth: usize,
}Expand description
An Obligation represents some trait reference (e.g., i32: Eq) for
which the “impl_source” must be found. The process of finding an “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: TThe thing we are trying to prove.
recursion_depth: usizeIf 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.
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
Mutably borrows from an owned value. Read more
pub fn subst_spanned(
self,
tcx: TyCtxt<'tcx>,
substs: &[GenericArg<'tcx>],
span: Option<Span>
) -> T
Layout
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.