aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/item_tree/lower.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-05-29 18:39:15 +0100
committerGitHub <[email protected]>2021-05-29 18:39:15 +0100
commitf6da603c7fe56c19a275dc7bab1f30fe1ad39707 (patch)
tree222351c552f11aed7e8f18a5447fc9c15afa42e0 /crates/hir_def/src/item_tree/lower.rs
parent0438e2ceaa89959fe3a1b21e5311a17b08b6fc6d (diff)
parent54d60fdee9a49e2081837cc6445c61dec0b303af (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_def/src/item_tree/lower.rs')
-rw-r--r--crates/hir_def/src/item_tree/lower.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/hir_def/src/item_tree/lower.rs b/crates/hir_def/src/item_tree/lower.rs
index b83adec46..6208facd5 100644
--- a/crates/hir_def/src/item_tree/lower.rs
+++ b/crates/hir_def/src/item_tree/lower.rs
@@ -356,12 +356,13 @@ impl<'a> Ctx<'a> {
356 _ => TypeRef::unit(), 356 _ => TypeRef::unit(),
357 }; 357 };
358 358
359 let ret_type = if func.async_token().is_some() { 359 let (ret_type, async_ret_type) = if func.async_token().is_some() {
360 let async_ret_type = ret_type.clone();
360 let future_impl = desugar_future_path(ret_type); 361 let future_impl = desugar_future_path(ret_type);
361 let ty_bound = Interned::new(TypeBound::Path(future_impl)); 362 let ty_bound = Interned::new(TypeBound::Path(future_impl));
362 TypeRef::ImplTrait(vec![ty_bound]) 363 (TypeRef::ImplTrait(vec![ty_bound]), Some(async_ret_type))
363 } else { 364 } else {
364 ret_type 365 (ret_type, None)
365 }; 366 };
366 367
367 let abi = func.abi().map(lower_abi); 368 let abi = func.abi().map(lower_abi);
@@ -395,6 +396,7 @@ impl<'a> Ctx<'a> {
395 abi, 396 abi,
396 params, 397 params,
397 ret_type: Interned::new(ret_type), 398 ret_type: Interned::new(ret_type),
399 async_ret_type: async_ret_type.map(Interned::new),
398 ast_id, 400 ast_id,
399 flags, 401 flags,
400 }; 402 };