Struct rustc_trait_selection::traits::FulfillmentContext[−][src]

pub struct FulfillmentContext<'tcx> {
    predicates: ObligationForest<PendingPredicateObligation<'tcx>>,
    register_region_obligations: bool,
    usable_in_snapshot: bool,
}
Expand description

The fulfillment context is used to drive trait resolution. It consists of a list of obligations that must be (eventually) satisfied. The job is to track which are satisfied, which yielded errors, and which are still pending. At any point, users can call select_where_possible, and the fulfillment context will try to do selection, retaining only those obligations that remain ambiguous. This may be helpful in pushing type inference along. Once all type inference constraints have been generated, the method select_all_or_error can be used to report any remaining ambiguous cases as errors.

Fields

predicates: ObligationForest<PendingPredicateObligation<'tcx>>register_region_obligations: boolusable_in_snapshot: bool

Implementations

impl<'a, 'tcx> FulfillmentContext<'tcx>[src]

pub fn new() -> FulfillmentContext<'tcx>[src]

Creates a new fulfillment context.

pub fn new_in_snapshot() -> FulfillmentContext<'tcx>[src]

pub fn new_ignoring_regions() -> FulfillmentContext<'tcx>[src]

fn select(
    &mut self,
    selcx: &mut SelectionContext<'a, 'tcx>
) -> Result<(), Vec<FulfillmentError<'tcx>>>
[src]

Attempts to select obligations using selcx.

Trait Implementations

impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx>[src]

fn normalize_projection_type(
    &mut self,
    infcx: &InferCtxt<'_, 'tcx>,
    param_env: ParamEnv<'tcx>,
    projection_ty: ProjectionTy<'tcx>,
    cause: ObligationCause<'tcx>
) -> Ty<'tcx>
[src]

“Normalize” a projection type <SomeType as SomeTrait>::X by creating a fresh type variable $0 as well as a projection predicate <SomeType as SomeTrait>::X == $0. When the inference engine runs, it will attempt to find an impl of SomeTrait or a where-clause that lets us unify $0 with something concrete. If this fails, we’ll unify $0 with projection_ty again.

fn register_predicate_obligation(
    &mut self,
    infcx: &InferCtxt<'_, 'tcx>,
    obligation: PredicateObligation<'tcx>
)
[src]

fn select_all_or_error(
    &mut self,
    infcx: &InferCtxt<'_, 'tcx>
) -> Result<(), Vec<FulfillmentError<'tcx>>>
[src]

fn select_where_possible(
    &mut self,
    infcx: &InferCtxt<'_, 'tcx>
) -> Result<(), Vec<FulfillmentError<'tcx>>>
[src]

fn pending_obligations(&self) -> Vec<PredicateObligation<'tcx>>[src]

fn register_bound(
    &mut self,
    infcx: &InferCtxt<'_, 'tcx>,
    param_env: ParamEnv<'tcx>,
    ty: &'tcx TyS<'tcx>,
    def_id: DefId,
    cause: ObligationCause<'tcx>
)
[src]

Requires that ty must implement the trait with def_id in the given environment. This trait must not have any type parameters (except for Self). Read more

Auto Trait Implementations

impl<'tcx> !RefUnwindSafe for FulfillmentContext<'tcx>

impl<'tcx> !Send for FulfillmentContext<'tcx>

impl<'tcx> !Sync for FulfillmentContext<'tcx>

impl<'tcx> Unpin for FulfillmentContext<'tcx>

impl<'tcx> !UnwindSafe for FulfillmentContext<'tcx>

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

impl<'tcx, T> TraitEngineExt<'tcx> for T where
    T: TraitEngine<'tcx> + ?Sized, 
[src]

pub fn register_predicate_obligations(
    &mut self,
    infcx: &InferCtxt<'_, 'tcx>,
    obligations: impl IntoIterator<Item = Obligation<'tcx, Predicate<'tcx>>>
)
[src]

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> WithConstness for T[src]

fn with_constness(self, constness: Constness) -> ConstnessAnd<Self>[src]

fn with_const(self) -> ConstnessAnd<Self>[src]

fn without_const(self) -> ConstnessAnd<Self>[src]