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

Fields

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

Whether we should define opaque types or just treat them opaquely. Currently only used to prevent predicate matching from matching anything against opaque types.

Implementations

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.

Attempts to generalize ty for the type variable for_vid. This checks for cycle – that is, whether the type ty references for_vid. The dir is the “direction” for which we a performing the generalization (i.e., are we producing a type that can be used as a supertype etc).

Preconditions:

  • for_vid is a “root vid”

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

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion 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: 120 bytes