Trait rustc_privacy::ty::relate::TypeRelation [−][src]
pub trait TypeRelation<'tcx> {
fn tcx(&self) -> TyCtxt<'tcx>;
fn param_env(&self) -> ParamEnv<'tcx>;
fn tag(&self) -> &'static str;
fn a_is_expected(&self) -> bool;
fn relate_with_variance<T>(
&mut self,
variance: Variance,
info: VarianceDiagInfo<'tcx>,
a: T,
b: T
) -> Result<T, TypeError<'tcx>>
where
T: Relate<'tcx>;
fn tys(
&mut self,
a: &'tcx TyS<'tcx>,
b: &'tcx TyS<'tcx>
) -> Result<&'tcx TyS<'tcx>, TypeError<'tcx>>;
fn regions(
&mut self,
a: &'tcx RegionKind,
b: &'tcx RegionKind
) -> Result<&'tcx RegionKind, TypeError<'tcx>>;
fn consts(
&mut self,
a: &'tcx Const<'tcx>,
b: &'tcx Const<'tcx>
) -> Result<&'tcx Const<'tcx>, TypeError<'tcx>>;
fn binders<T>(
&mut self,
a: Binder<'tcx, T>,
b: Binder<'tcx, T>
) -> Result<Binder<'tcx, T>, TypeError<'tcx>>
where
T: Relate<'tcx>;
fn with_cause<F, R>(&mut self, _cause: Cause, f: F) -> R
where
F: FnOnce(&mut Self) -> R,
{ ... }
fn relate<T>(&mut self, a: T, b: T) -> Result<T, TypeError<'tcx>>
where
T: Relate<'tcx>,
{ ... }
fn relate_item_substs(
&mut self,
item_def_id: DefId,
a_subst: &'tcx List<GenericArg<'tcx>>,
b_subst: &'tcx List<GenericArg<'tcx>>
) -> Result<&'tcx List<GenericArg<'tcx>>, TypeError<'tcx>> { ... }
}Required methods
fn a_is_expected(&self) -> bool
fn a_is_expected(&self) -> bool
Returns true if the value a is the “expected” type in the
relation. Just affects error messages.
fn relate_with_variance<T>(
&mut self,
variance: Variance,
info: VarianceDiagInfo<'tcx>,
a: T,
b: T
) -> Result<T, TypeError<'tcx>> where
T: Relate<'tcx>,
fn relate_with_variance<T>(
&mut self,
variance: Variance,
info: VarianceDiagInfo<'tcx>,
a: T,
b: T
) -> Result<T, TypeError<'tcx>> where
T: Relate<'tcx>,
Switch variance for the purpose of relating a and b.
fn tys(
&mut self,
a: &'tcx TyS<'tcx>,
b: &'tcx TyS<'tcx>
) -> Result<&'tcx TyS<'tcx>, TypeError<'tcx>>
fn regions(
&mut self,
a: &'tcx RegionKind,
b: &'tcx RegionKind
) -> Result<&'tcx RegionKind, TypeError<'tcx>>
Provided methods
fn with_cause<F, R>(&mut self, _cause: Cause, f: F) -> R where
F: FnOnce(&mut Self) -> R,
Generic relation routine suitable for most anything.
fn relate_item_substs(
&mut self,
item_def_id: DefId,
a_subst: &'tcx List<GenericArg<'tcx>>,
b_subst: &'tcx List<GenericArg<'tcx>>
) -> Result<&'tcx List<GenericArg<'tcx>>, TypeError<'tcx>>
fn relate_item_substs(
&mut self,
item_def_id: DefId,
a_subst: &'tcx List<GenericArg<'tcx>>,
b_subst: &'tcx List<GenericArg<'tcx>>
) -> Result<&'tcx List<GenericArg<'tcx>>, TypeError<'tcx>>
Relate the two substitutions for the given item. The default is to look up the variance for the item and proceed accordingly.