diff options
author | Florian Diebold <[email protected]> | 2019-09-24 18:04:53 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-09-24 22:05:12 +0100 |
commit | a0aeb6e7ad7385811a4bb75577513339c9a9ed91 (patch) | |
tree | 6e818506cbf3ecd50a055536b95d99a70a60c261 /crates/ra_hir/src/ty/infer.rs | |
parent | 3b06faad26fdb1485c542970374ff8bbcb0e01c4 (diff) |
Make the closure_1 test work
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 | } |