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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

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