aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/infer/unify.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/infer/unify.rs')
-rw-r--r--crates/hir_ty/src/infer/unify.rs14
1 files changed, 3 insertions, 11 deletions
diff --git a/crates/hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs
index 3a4258e86..a635501b5 100644
--- a/crates/hir_ty/src/infer/unify.rs
+++ b/crates/hir_ty/src/infer/unify.rs
@@ -134,18 +134,10 @@ pub(super) struct TypeVariableTable {
134} 134}
135 135
136impl TypeVariableTable { 136impl TypeVariableTable {
137 fn push(&mut self, data: TypeVariableData) {
138 self.inner.push(data);
139 }
140
141 pub(super) fn set_diverging(&mut self, iv: InferenceVar, diverging: bool) { 137 pub(super) fn set_diverging(&mut self, iv: InferenceVar, diverging: bool) {
142 self.inner[iv.index() as usize].diverging = diverging; 138 self.inner[iv.index() as usize].diverging = diverging;
143 } 139 }
144 140
145 fn is_diverging(&mut self, iv: InferenceVar) -> bool {
146 self.inner[iv.index() as usize].diverging
147 }
148
149 fn fallback_value(&self, iv: InferenceVar, kind: TyVariableKind) -> Ty { 141 fn fallback_value(&self, iv: InferenceVar, kind: TyVariableKind) -> Ty {
150 match kind { 142 match kind {
151 _ if self.inner[iv.index() as usize].diverging => TyKind::Never, 143 _ if self.inner[iv.index() as usize].diverging => TyKind::Never,
@@ -221,7 +213,7 @@ impl<'a> InferenceTable<'a> {
221 /// Unify two types and register new trait goals that arise from that. 213 /// Unify two types and register new trait goals that arise from that.
222 // TODO give these two functions better names 214 // TODO give these two functions better names
223 pub(crate) fn unify(&mut self, ty1: &Ty, ty2: &Ty) -> bool { 215 pub(crate) fn unify(&mut self, ty1: &Ty, ty2: &Ty) -> bool {
224 let result = if let Ok(r) = self.unify_inner(ty1, ty2) { 216 let _result = if let Ok(r) = self.unify_inner(ty1, ty2) {
225 r 217 r
226 } else { 218 } else {
227 return false; 219 return false;
@@ -241,11 +233,11 @@ impl<'a> InferenceTable<'a> {
241 ty1, 233 ty1,
242 ty2, 234 ty2,
243 ) { 235 ) {
244 Ok(result) => { 236 Ok(_result) => {
245 // TODO deal with new goals 237 // TODO deal with new goals
246 Ok(InferOk {}) 238 Ok(InferOk {})
247 } 239 }
248 Err(NoSolution) => Err(TypeError), 240 Err(chalk_ir::NoSolution) => Err(TypeError),
249 } 241 }
250 } 242 }
251 243