diff options
Diffstat (limited to 'crates/hir_def/src/item_tree/lower.rs')
-rw-r--r-- | crates/hir_def/src/item_tree/lower.rs | 8 |
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 | }; |