diff options
| author | Michael Goulet <michael@errs.io> | 2025-06-05 17:02:49 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2025-06-05 17:02:51 +0000 |
| commit | e1567dff243135a84f8e348528da782bee1d13e9 (patch) | |
| tree | 2f84ed3fc3bc5c91d565c4ded9b1f1f8b1183382 /compiler/rustc_infer/src | |
| parent | c360e219f5a56631baa46065d28e9852ca7d4ce3 (diff) | |
| download | rust-e1567dff243135a84f8e348528da782bee1d13e9.tar.gz rust-e1567dff243135a84f8e348528da782bee1d13e9.zip | |
Make root vars more stable
Diffstat (limited to 'compiler/rustc_infer/src')
| -rw-r--r-- | compiler/rustc_infer/src/infer/type_variable.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_infer/src/infer/unify_key.rs | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_infer/src/infer/type_variable.rs b/compiler/rustc_infer/src/infer/type_variable.rs index 2086483b94a..6f6791804d3 100644 --- a/compiler/rustc_infer/src/infer/type_variable.rs +++ b/compiler/rustc_infer/src/infer/type_variable.rs @@ -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> { diff --git a/compiler/rustc_infer/src/infer/unify_key.rs b/compiler/rustc_infer/src/infer/unify_key.rs index 3ba8aea1d3a..5e5d0e063a0 100644 --- a/compiler/rustc_infer/src/infer/unify_key.rs +++ b/compiler/rustc_infer/src/infer/unify_key.rs @@ -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> { |
