Skip to main content

TypeRelation

Trait TypeRelation 

Source
pub trait TypeRelation<I: Interner>: Sized {
    // Required methods
    fn cx(&self) -> I;
    fn relate_ty_args(
        &mut self,
        a_ty: I::Ty,
        b_ty: I::Ty,
        ty_def_id: I::DefId,
        a_arg: I::GenericArgs,
        b_arg: I::GenericArgs,
        mk: impl FnOnce(I::GenericArgs) -> I::Ty,
    ) -> RelateResult<I, I::Ty>;
    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 method
    fn relate<T: Relate<I>>(&mut self, a: T, b: T) -> RelateResult<I, T> { ... }
}

Required Methods§

Source

fn cx(&self) -> I

Source

fn relate_ty_args( &mut self, a_ty: I::Ty, b_ty: I::Ty, ty_def_id: I::DefId, a_arg: I::GenericArgs, b_arg: I::GenericArgs, mk: impl FnOnce(I::GenericArgs) -> I::Ty, ) -> RelateResult<I, I::Ty>

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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'a, Infcx: InferCtxtLike<Interner = I>, I: Interner> TypeRelation<I> for HigherRankedAliasMatcher<'a, Infcx, I>

Source§

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