Move implementation of UnifyKey to unify_key.rs.

This commit is contained in:
Camille GILLOT 2020-01-22 13:39:53 +01:00
parent 005f14d518
commit b3f13b00f5
2 changed files with 15 additions and 15 deletions

View File

@ -453,18 +453,3 @@ impl<'tcx> ut::UnifyValue for TypeVariableValue<'tcx> {
}
}
}
/// Raw `TyVid` are used as the unification key for `sub_relations`;
/// they carry no values.
impl ut::UnifyKey for ty::TyVid {
type Value = ();
fn index(&self) -> u32 {
self.index
}
fn from_index(i: u32) -> ty::TyVid {
ty::TyVid { index: i }
}
fn tag() -> &'static str {
"TyVid"
}
}

View File

@ -12,6 +12,21 @@ pub trait ToType {
fn to_type<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx>;
}
/// Raw `TyVid` are used as the unification key for `sub_relations`;
/// they carry no values.
impl UnifyKey for ty::TyVid {
type Value = ();
fn index(&self) -> u32 {
self.index
}
fn from_index(i: u32) -> ty::TyVid {
ty::TyVid { index: i }
}
fn tag() -> &'static str {
"TyVid"
}
}
impl UnifyKey for ty::IntVid {
type Value = Option<IntVarValue>;
fn index(&self) -> u32 {