From b58a7f41f14f56375c602911be768d40cf46de04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Sun, 5 Apr 2020 18:18:40 +0300 Subject: Fix inference of function pointer return types --- crates/ra_hir_def/src/type_ref.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'crates/ra_hir_def') diff --git a/crates/ra_hir_def/src/type_ref.rs b/crates/ra_hir_def/src/type_ref.rs index 102fdb13d..01cc392db 100644 --- a/crates/ra_hir_def/src/type_ref.rs +++ b/crates/ra_hir_def/src/type_ref.rs @@ -93,7 +93,11 @@ impl TypeRef { } ast::TypeRef::PlaceholderType(_inner) => TypeRef::Placeholder, ast::TypeRef::FnPointerType(inner) => { - let ret_ty = TypeRef::from_ast_opt(inner.ret_type().and_then(|rt| rt.type_ref())); + let ret_ty = inner + .ret_type() + .and_then(|rt| rt.type_ref()) + .map(TypeRef::from_ast) + .unwrap_or_else(|| TypeRef::Tuple(Vec::new())); let mut params = if let Some(pl) = inner.param_list() { pl.params().map(|p| p.ascribed_type()).map(TypeRef::from_ast_opt).collect() } else { -- cgit v1.2.3