diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-04-05 16:23:10 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-05 16:23:10 +0100 |
commit | 3431312418ea255e98d3f94536344d396b9b07d6 (patch) | |
tree | 9c27eb88a68fceade7480ac83b1ba271c8e1f6f0 /crates/ra_hir_def | |
parent | e300e1e8d8f4de273d52fa62762ed14e8a7f96bb (diff) | |
parent | b58a7f41f14f56375c602911be768d40cf46de04 (diff) |
Merge #3857
3857: Fix inference of function pointer return types r=flodiebold a=lnicola
Fixes #3852.
r? @flodiebold
Co-authored-by: Laurențiu Nicola <[email protected]>
Diffstat (limited to 'crates/ra_hir_def')
-rw-r--r-- | crates/ra_hir_def/src/type_ref.rs | 6 |
1 files changed, 5 insertions, 1 deletions
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 { | |||
93 | } | 93 | } |
94 | ast::TypeRef::PlaceholderType(_inner) => TypeRef::Placeholder, | 94 | ast::TypeRef::PlaceholderType(_inner) => TypeRef::Placeholder, |
95 | ast::TypeRef::FnPointerType(inner) => { | 95 | ast::TypeRef::FnPointerType(inner) => { |
96 | let ret_ty = TypeRef::from_ast_opt(inner.ret_type().and_then(|rt| rt.type_ref())); | 96 | let ret_ty = inner |
97 | .ret_type() | ||
98 | .and_then(|rt| rt.type_ref()) | ||
99 | .map(TypeRef::from_ast) | ||
100 | .unwrap_or_else(|| TypeRef::Tuple(Vec::new())); | ||
97 | let mut params = if let Some(pl) = inner.param_list() { | 101 | let mut params = if let Some(pl) = inner.param_list() { |
98 | pl.params().map(|p| p.ascribed_type()).map(TypeRef::from_ast_opt).collect() | 102 | pl.params().map(|p| p.ascribed_type()).map(TypeRef::from_ast_opt).collect() |
99 | } else { | 103 | } else { |