pub struct CombineFields<'infcx, 'tcx> {
    pub infcx: &'infcx InferCtxt<'tcx>,
    pub trace: TypeTrace<'tcx>,
    pub cause: Option<Cause>,
    pub param_env: ParamEnv<'tcx>,
    pub obligations: PredicateObligations<'tcx>,
    pub define_opaque_types: DefineOpaqueTypes,
}

Fields§

§infcx: &'infcx InferCtxt<'tcx>§trace: TypeTrace<'tcx>§cause: Option<Cause>§param_env: ParamEnv<'tcx>§obligations: PredicateObligations<'tcx>§define_opaque_types: DefineOpaqueTypes

Implementations§

source§

impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx>

source

pub fn tcx(&self) -> TyCtxt<'tcx>

source

pub fn equate<'a>(&'a mut self, a_is_expected: bool) -> Equate<'a, 'infcx, 'tcx>

source

pub fn sub<'a>(&'a mut self, a_is_expected: bool) -> Sub<'a, 'infcx, 'tcx>

source

pub fn lub<'a>(&'a mut self, a_is_expected: bool) -> Lub<'a, 'infcx, 'tcx>

source

pub fn glb<'a>(&'a mut self, a_is_expected: bool) -> Glb<'a, 'infcx, 'tcx>

source

pub fn instantiate( &mut self, a_ty: Ty<'tcx>, ambient_variance: Variance, b_vid: TyVid, a_is_expected: bool ) -> RelateResult<'tcx, ()>

Here, dir is either EqTo, SubtypeOf, or SupertypeOf. The idea is that we should ensure that the type a_ty is equal to, a subtype of, or a supertype of (respectively) the type to which b_vid is bound.

Since b_vid has not yet been instantiated with a type, we will first instantiate b_vid with a generalized version of a_ty. Generalization introduces other inference variables wherever subtyping could occur.

source

pub fn register_obligations(&mut self, obligations: PredicateObligations<'tcx>)

source

pub fn register_predicates( &mut self, obligations: impl IntoIterator<Item: ToPredicate<'tcx>> )

source§

impl<'a, 'tcx> CombineFields<'a, 'tcx>

source

pub fn higher_ranked_sub<T>( &mut self, sub: Binder<'tcx, T>, sup: Binder<'tcx, T>, sub_is_expected: bool ) -> RelateResult<'tcx, ()>where T: Relate<'tcx>,

Checks whether for<..> sub <: for<..> sup holds.

For this to hold, all instantiations of the super type have to be a super type of at least one instantiation of the subtype.

This is implemented by first entering a new universe. We then replace all bound variables in sup with placeholders, and all bound variables in sub with inference vars. We can then just relate the two resulting types as normal.

Note: this is a subtle algorithm. For a full explanation, please see the rustc dev guide

Trait Implementations§

source§

impl<'infcx, 'tcx> Clone for CombineFields<'infcx, 'tcx>

source§

fn clone(&self) -> CombineFields<'infcx, 'tcx>

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

Auto Trait Implementations§

§

impl<'infcx, 'tcx> !RefUnwindSafe for CombineFields<'infcx, 'tcx>

§

impl<'infcx, 'tcx> !Send for CombineFields<'infcx, 'tcx>

§

impl<'infcx, 'tcx> !Sync for CombineFields<'infcx, 'tcx>

§

impl<'infcx, 'tcx> Unpin for CombineFields<'infcx, 'tcx>

§

impl<'infcx, 'tcx> !UnwindSafe for CombineFields<'infcx, 'tcx>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.

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