From 693582946fae1813627ad59f60a31c9237e98744 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sat, 1 May 2021 21:53:10 +0200 Subject: Rewrite coercion using the new unification --- crates/hir_ty/src/infer.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'crates/hir_ty/src/infer.rs') 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 { } } +#[derive(Debug)] +pub(crate) struct InferOk { + // obligations +} +#[derive(Debug)] +pub(crate) struct TypeError; +pub(crate) type InferResult = Result; + /// A mismatch between an expected and an inferred type. #[derive(Clone, PartialEq, Eq, Debug, Hash)] pub struct TypeMismatch { @@ -390,6 +398,10 @@ impl<'a> InferenceContext<'a> { self.table.unify(ty1, ty2) } + fn unify_inner(&mut self, ty1: &Ty, ty2: &Ty) -> InferResult { + self.table.unify_inner(ty1, ty2) + } + // FIXME get rid of this, instead resolve shallowly where necessary /// Resolves the type as far as currently possible, replacing type variables /// by their known types. All types returned by the infer_* functions should -- cgit v1.2.3