From d0c9bb0abf764a3143fc0d13297d73184bc10397 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 8 Dec 2019 11:23:05 +0100 Subject: Fix coercion from &Foo to an inference variable in a reference We didn't try to unify within the reference, but we should. --- crates/ra_hir_ty/src/infer/coerce.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'crates/ra_hir_ty/src/infer/coerce.rs') diff --git a/crates/ra_hir_ty/src/infer/coerce.rs b/crates/ra_hir_ty/src/infer/coerce.rs index 9daa77cfa..0f4dac45e 100644 --- a/crates/ra_hir_ty/src/infer/coerce.rs +++ b/crates/ra_hir_ty/src/infer/coerce.rs @@ -332,7 +332,11 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { // It will not recurse to `coerce`. return self.table.unify_substs(st1, st2, 0); } - _ => {} + _ => { + if self.table.unify_inner_trivial(&derefed_ty, &to_ty) { + return true; + } + } } } -- cgit v1.2.3