Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions compiler/rustc_infer/src/infer/type_variable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ impl<'tcx> ut::UnifyKey for TyVidEqKey<'tcx> {
fn tag() -> &'static str {
"TyVidEqKey"
}
fn order_roots(a: Self, _: &Self::Value, b: Self, _: &Self::Value) -> Option<(Self, Self)> {
if a.vid.as_u32() < b.vid.as_u32() { Some((a, b)) } else { Some((b, a)) }
}
}

impl<'tcx> ut::UnifyValue for TypeVariableValue<'tcx> {
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_infer/src/infer/unify_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ impl<'tcx> UnifyKey for ConstVidKey<'tcx> {
fn tag() -> &'static str {
"ConstVidKey"
}
fn order_roots(a: Self, _: &Self::Value, b: Self, _: &Self::Value) -> Option<(Self, Self)> {
if a.vid.as_u32() < b.vid.as_u32() { Some((a, b)) } else { Some((b, a)) }
}
}

impl<'tcx> UnifyValue for ConstVariableValue<'tcx> {
Expand Down
17 changes: 0 additions & 17 deletions compiler/rustc_type_ir/src/ty_kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -771,23 +771,6 @@ pub enum InferTy {
FreshFloatTy(u32),
}

/// Raw `TyVid` are used as the unification key for `sub_relations`;
/// they carry no values.
impl UnifyKey for TyVid {
type Value = ();
#[inline]
fn index(&self) -> u32 {
self.as_u32()
}
#[inline]
fn from_index(i: u32) -> TyVid {
TyVid::from_u32(i)
}
fn tag() -> &'static str {
"TyVid"
}
}

impl UnifyValue for IntVarValue {
type Error = NoError;

Expand Down
Loading