diff options
Diffstat (limited to 'crates/ra_hir/src/ty/infer.rs')
-rw-r--r-- | crates/ra_hir/src/ty/infer.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs index c04f2a0c4..4784fad85 100644 --- a/crates/ra_hir/src/ty/infer.rs +++ b/crates/ra_hir/src/ty/infer.rs | |||
@@ -909,6 +909,11 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
909 | sig_ty, | 909 | sig_ty, |
910 | ); | 910 | ); |
911 | 911 | ||
912 | // Eagerly try to relate the closure type with the expected | ||
913 | // type, otherwise we often won't have enough information to | ||
914 | // infer the body. | ||
915 | self.coerce(&closure_ty, &expected.ty); | ||
916 | |||
912 | self.infer_expr(*body, &Expectation::has_type(ret_ty)); | 917 | self.infer_expr(*body, &Expectation::has_type(ret_ty)); |
913 | closure_ty | 918 | closure_ty |
914 | } | 919 | } |