diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-05-29 18:39:15 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-05-29 18:39:15 +0100 |
commit | f6da603c7fe56c19a275dc7bab1f30fe1ad39707 (patch) | |
tree | 222351c552f11aed7e8f18a5447fc9c15afa42e0 /crates/hir_ty/src/infer.rs | |
parent | 0438e2ceaa89959fe3a1b21e5311a17b08b6fc6d (diff) | |
parent | 54d60fdee9a49e2081837cc6445c61dec0b303af (diff) |
Merge #9050
9050: hir_ty: use async ret type for inference inside async bodies r=flodiebold a=cynecx
Fixes #9004.
Co-authored-by: cynecx <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/infer.rs')
-rw-r--r-- | crates/hir_ty/src/infer.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/hir_ty/src/infer.rs b/crates/hir_ty/src/infer.rs index 8cefd80f3..7a4268819 100644 --- a/crates/hir_ty/src/infer.rs +++ b/crates/hir_ty/src/infer.rs | |||
@@ -558,7 +558,13 @@ impl<'a> InferenceContext<'a> { | |||
558 | 558 | ||
559 | self.infer_pat(*pat, &ty, BindingMode::default()); | 559 | self.infer_pat(*pat, &ty, BindingMode::default()); |
560 | } | 560 | } |
561 | let return_ty = self.make_ty_with_mode(&data.ret_type, ImplTraitLoweringMode::Disallowed); // FIXME implement RPIT | 561 | let error_ty = &TypeRef::Error; |
562 | let return_ty = if data.is_async() { | ||
563 | data.async_ret_type.as_deref().unwrap_or(error_ty) | ||
564 | } else { | ||
565 | &*data.ret_type | ||
566 | }; | ||
567 | let return_ty = self.make_ty_with_mode(return_ty, ImplTraitLoweringMode::Disallowed); // FIXME implement RPIT | ||
562 | self.return_ty = return_ty; | 568 | self.return_ty = return_ty; |
563 | } | 569 | } |
564 | 570 | ||