pub trait TypeRelation<I>: Sizedwhere
I: Interner,{
// Required methods
fn cx(&self) -> I;
fn relate_with_variance<T>(
&mut self,
variance: Variance,
info: VarianceDiagInfo<I>,
a: T,
b: T,
) -> Result<T, TypeError<I>>
where T: Relate<I>;
fn tys(
&mut self,
a: <I as Interner>::Ty,
b: <I as Interner>::Ty,
) -> Result<<I as Interner>::Ty, TypeError<I>>;
fn regions(
&mut self,
a: <I as Interner>::Region,
b: <I as Interner>::Region,
) -> Result<<I as Interner>::Region, TypeError<I>>;
fn consts(
&mut self,
a: <I as Interner>::Const,
b: <I as Interner>::Const,
) -> Result<<I as Interner>::Const, TypeError<I>>;
fn binders<T>(
&mut self,
a: Binder<I, T>,
b: Binder<I, T>,
) -> Result<Binder<I, T>, TypeError<I>>
where T: Relate<I>;
// Provided methods
fn relate<T>(&mut self, a: T, b: T) -> Result<T, TypeError<I>>
where T: Relate<I> { ... }
fn relate_item_args(
&mut self,
item_def_id: <I as Interner>::DefId,
a_arg: <I as Interner>::GenericArgs,
b_arg: <I as Interner>::GenericArgs,
) -> Result<<I as Interner>::GenericArgs, TypeError<I>> { ... }
}
Required Methods§
fn cx(&self) -> I
sourcefn relate_with_variance<T>(
&mut self,
variance: Variance,
info: VarianceDiagInfo<I>,
a: T,
b: T,
) -> Result<T, TypeError<I>>where
T: Relate<I>,
fn relate_with_variance<T>(
&mut self,
variance: Variance,
info: VarianceDiagInfo<I>,
a: T,
b: T,
) -> Result<T, TypeError<I>>where
T: Relate<I>,
Switch variance for the purpose of relating a
and b
.
fn tys( &mut self, a: <I as Interner>::Ty, b: <I as Interner>::Ty, ) -> Result<<I as Interner>::Ty, TypeError<I>>
fn regions( &mut self, a: <I as Interner>::Region, b: <I as Interner>::Region, ) -> Result<<I as Interner>::Region, TypeError<I>>
fn consts( &mut self, a: <I as Interner>::Const, b: <I as Interner>::Const, ) -> Result<<I as Interner>::Const, TypeError<I>>
fn binders<T>(
&mut self,
a: Binder<I, T>,
b: Binder<I, T>,
) -> Result<Binder<I, T>, TypeError<I>>where
T: Relate<I>,
Provided Methods§
sourcefn relate<T>(&mut self, a: T, b: T) -> Result<T, TypeError<I>>where
T: Relate<I>,
fn relate<T>(&mut self, a: T, b: T) -> Result<T, TypeError<I>>where
T: Relate<I>,
Generic relation routine suitable for most anything.
sourcefn relate_item_args(
&mut self,
item_def_id: <I as Interner>::DefId,
a_arg: <I as Interner>::GenericArgs,
b_arg: <I as Interner>::GenericArgs,
) -> Result<<I as Interner>::GenericArgs, TypeError<I>>
fn relate_item_args( &mut self, item_def_id: <I as Interner>::DefId, a_arg: <I as Interner>::GenericArgs, b_arg: <I as Interner>::GenericArgs, ) -> Result<<I as Interner>::GenericArgs, TypeError<I>>
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.