Trait rustc_infer::infer::nll_relate::VidValuePair
source · trait VidValuePair<'tcx>: Debug {
// Required methods
fn vid(&self) -> TyVid;
fn value_ty(&self) -> Ty<'tcx>;
fn relate_generalized_ty<D>(
&self,
relate: &mut TypeRelating<'_, 'tcx, D>,
generalized_ty: Ty<'tcx>
) -> RelateResult<'tcx, Ty<'tcx>>
where D: TypeRelatingDelegate<'tcx>;
}
Expand description
When we instantiate an inference variable with a value in
relate_ty_var
, we always have the pair of a TyVid
and a Ty
,
but the ordering may vary (depending on whether the inference
variable was found on the a
or b
sides). Therefore, this trait
allows us to factor out common code, while preserving the order
when needed.
Required Methods§
sourcefn vid(&self) -> TyVid
fn vid(&self) -> TyVid
Extract the inference variable (which could be either the first or second part of the tuple).
sourcefn value_ty(&self) -> Ty<'tcx>
fn value_ty(&self) -> Ty<'tcx>
Extract the value it is being related to (which will be the opposite part of the tuple from the vid).
sourcefn relate_generalized_ty<D>(
&self,
relate: &mut TypeRelating<'_, 'tcx, D>,
generalized_ty: Ty<'tcx>
) -> RelateResult<'tcx, Ty<'tcx>>where
D: TypeRelatingDelegate<'tcx>,
fn relate_generalized_ty<D>( &self, relate: &mut TypeRelating<'_, 'tcx, D>, generalized_ty: Ty<'tcx> ) -> RelateResult<'tcx, Ty<'tcx>>where D: TypeRelatingDelegate<'tcx>,
Given a generalized type G that should replace the vid, relate G to the value, putting G on whichever side the vid would have appeared.