diff options
author | Florian Diebold <[email protected]> | 2021-04-03 16:49:29 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2021-04-08 13:08:55 +0100 |
commit | 7e541e69b1eaab3c242c864a0930cb263d2cbaf5 (patch) | |
tree | 88fb29aa7e0b782efc9f91ec5676d93e4db4ffd7 /crates/hir_ty/src/infer | |
parent | 926bfef0efc5caca2a04a50beaba9127338e21e0 (diff) |
Add HasInterner bounds
Diffstat (limited to 'crates/hir_ty/src/infer')
-rw-r--r-- | crates/hir_ty/src/infer/unify.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/crates/hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs index 2ea9dd920..3732d8ebd 100644 --- a/crates/hir_ty/src/infer/unify.rs +++ b/crates/hir_ty/src/infer/unify.rs | |||
@@ -2,7 +2,9 @@ | |||
2 | 2 | ||
3 | use std::borrow::Cow; | 3 | use std::borrow::Cow; |
4 | 4 | ||
5 | use chalk_ir::{FloatTy, IntTy, TyVariableKind, UniverseIndex, VariableKind}; | 5 | use chalk_ir::{ |
6 | interner::HasInterner, FloatTy, IntTy, TyVariableKind, UniverseIndex, VariableKind, | ||
7 | }; | ||
6 | use ena::unify::{InPlaceUnificationTable, NoError, UnifyKey, UnifyValue}; | 8 | use ena::unify::{InPlaceUnificationTable, NoError, UnifyKey, UnifyValue}; |
7 | 9 | ||
8 | use super::{DomainGoal, InferenceContext}; | 10 | use super::{DomainGoal, InferenceContext}; |
@@ -34,7 +36,10 @@ where | |||
34 | } | 36 | } |
35 | 37 | ||
36 | #[derive(Debug)] | 38 | #[derive(Debug)] |
37 | pub(super) struct Canonicalized<T> { | 39 | pub(super) struct Canonicalized<T> |
40 | where | ||
41 | T: HasInterner<Interner = Interner>, | ||
42 | { | ||
38 | pub(super) value: Canonical<T>, | 43 | pub(super) value: Canonical<T>, |
39 | free_vars: Vec<(InferenceVar, TyVariableKind)>, | 44 | free_vars: Vec<(InferenceVar, TyVariableKind)>, |
40 | } | 45 | } |
@@ -76,7 +81,10 @@ impl<'a, 'b> Canonicalizer<'a, 'b> { | |||
76 | ) | 81 | ) |
77 | } | 82 | } |
78 | 83 | ||
79 | fn into_canonicalized<T>(self, result: T) -> Canonicalized<T> { | 84 | fn into_canonicalized<T: HasInterner<Interner = Interner>>( |
85 | self, | ||
86 | result: T, | ||
87 | ) -> Canonicalized<T> { | ||
80 | let kinds = self | 88 | let kinds = self |
81 | .free_vars | 89 | .free_vars |
82 | .iter() | 90 | .iter() |
@@ -108,7 +116,7 @@ impl<'a, 'b> Canonicalizer<'a, 'b> { | |||
108 | } | 116 | } |
109 | } | 117 | } |
110 | 118 | ||
111 | impl<T> Canonicalized<T> { | 119 | impl<T: HasInterner<Interner = Interner>> Canonicalized<T> { |
112 | pub(super) fn decanonicalize_ty(&self, ty: Ty) -> Ty { | 120 | pub(super) fn decanonicalize_ty(&self, ty: Ty) -> Ty { |
113 | ty.fold_binders( | 121 | ty.fold_binders( |
114 | &mut |ty, binders| { | 122 | &mut |ty, binders| { |