rustc_type_ir::relate

Trait TypeRelation

source
pub trait TypeRelation<I: Interner>: Sized {
    // Required methods
    fn cx(&self) -> I;
    fn relate_with_variance<T: Relate<I>>(
        &mut self,
        variance: Variance,
        info: VarianceDiagInfo<I>,
        a: T,
        b: T,
    ) -> RelateResult<I, T>;
    fn tys(&mut self, a: I::Ty, b: I::Ty) -> RelateResult<I, I::Ty>;
    fn regions(
        &mut self,
        a: I::Region,
        b: I::Region,
    ) -> RelateResult<I, I::Region>;
    fn consts(&mut self, a: I::Const, b: I::Const) -> RelateResult<I, I::Const>;
    fn binders<T>(
        &mut self,
        a: Binder<I, T>,
        b: Binder<I, T>,
    ) -> RelateResult<I, Binder<I, T>>
       where T: Relate<I>;

    // Provided methods
    fn relate<T: Relate<I>>(&mut self, a: T, b: T) -> RelateResult<I, T> { ... }
    fn relate_item_args(
        &mut self,
        item_def_id: I::DefId,
        a_arg: I::GenericArgs,
        b_arg: I::GenericArgs,
    ) -> RelateResult<I, I::GenericArgs> { ... }
}

Required Methods§

source

fn cx(&self) -> I

source

fn relate_with_variance<T: Relate<I>>( &mut self, variance: Variance, info: VarianceDiagInfo<I>, a: T, b: T, ) -> RelateResult<I, T>

Switch variance for the purpose of relating a and b.

source

fn tys(&mut self, a: I::Ty, b: I::Ty) -> RelateResult<I, I::Ty>

source

fn regions(&mut self, a: I::Region, b: I::Region) -> RelateResult<I, I::Region>

source

fn consts(&mut self, a: I::Const, b: I::Const) -> RelateResult<I, I::Const>

source

fn binders<T>( &mut self, a: Binder<I, T>, b: Binder<I, T>, ) -> RelateResult<I, Binder<I, T>>
where T: Relate<I>,

Provided Methods§

source

fn relate<T: Relate<I>>(&mut self, a: T, b: T) -> RelateResult<I, T>

Generic relation routine suitable for most anything.

source

fn relate_item_args( &mut self, item_def_id: I::DefId, a_arg: I::GenericArgs, b_arg: I::GenericArgs, ) -> RelateResult<I, I::GenericArgs>

Relate the two args for the given item. The default is to look up the variance for the item and proceed accordingly.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<Infcx, I> TypeRelation<I> for SolverRelating<'_, Infcx, I>
where Infcx: InferCtxtLike<Interner = I>, I: Interner,