aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/infer.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-05-01 20:53:10 +0100
committerFlorian Diebold <[email protected]>2021-05-21 16:48:33 +0100
commit693582946fae1813627ad59f60a31c9237e98744 (patch)
tree7c546542a5e76b8e1a958f867faddd1c04b05d07 /crates/hir_ty/src/infer.rs
parent84074cb1852aa702e1307e9533e1fa3448e3e04f (diff)
Rewrite coercion using the new unification
Diffstat (limited to 'crates/hir_ty/src/infer.rs')
-rw-r--r--crates/hir_ty/src/infer.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/crates/hir_ty/src/infer.rs b/crates/hir_ty/src/infer.rs
index 2a82f1b47..603068ab5 100644
--- a/crates/hir_ty/src/infer.rs
+++ b/crates/hir_ty/src/infer.rs
@@ -106,6 +106,14 @@ impl Default for BindingMode {
106 } 106 }
107} 107}
108 108
109#[derive(Debug)]
110pub(crate) struct InferOk {
111 // obligations
112}
113#[derive(Debug)]
114pub(crate) struct TypeError;
115pub(crate) type InferResult = Result<InferOk, TypeError>;
116
109/// A mismatch between an expected and an inferred type. 117/// A mismatch between an expected and an inferred type.
110#[derive(Clone, PartialEq, Eq, Debug, Hash)] 118#[derive(Clone, PartialEq, Eq, Debug, Hash)]
111pub struct TypeMismatch { 119pub struct TypeMismatch {
@@ -390,6 +398,10 @@ impl<'a> InferenceContext<'a> {
390 self.table.unify(ty1, ty2) 398 self.table.unify(ty1, ty2)
391 } 399 }
392 400
401 fn unify_inner(&mut self, ty1: &Ty, ty2: &Ty) -> InferResult {
402 self.table.unify_inner(ty1, ty2)
403 }
404
393 // FIXME get rid of this, instead resolve shallowly where necessary 405 // FIXME get rid of this, instead resolve shallowly where necessary
394 /// Resolves the type as far as currently possible, replacing type variables 406 /// Resolves the type as far as currently possible, replacing type variables
395 /// by their known types. All types returned by the infer_* functions should 407 /// by their known types. All types returned by the infer_* functions should