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_ty/src/tests | |
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_ty/src/tests')
-rw-r--r-- | crates/ra_hir_ty/src/tests/simple.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/tests/simple.rs b/crates/ra_hir_ty/src/tests/simple.rs index a600b947d..141f0245a 100644 --- a/crates/ra_hir_ty/src/tests/simple.rs +++ b/crates/ra_hir_ty/src/tests/simple.rs | |||
@@ -1729,3 +1729,29 @@ fn foo() -> u32 { | |||
1729 | "### | 1729 | "### |
1730 | ); | 1730 | ); |
1731 | } | 1731 | } |
1732 | |||
1733 | #[test] | ||
1734 | fn fn_pointer_return() { | ||
1735 | assert_snapshot!( | ||
1736 | infer(r#" | ||
1737 | struct Vtable { | ||
1738 | method: fn(), | ||
1739 | } | ||
1740 | |||
1741 | fn main() { | ||
1742 | let vtable = Vtable { method: || {} }; | ||
1743 | let m = vtable.method; | ||
1744 | } | ||
1745 | "#), | ||
1746 | @r###" | ||
1747 | [48; 121) '{ ...hod; }': () | ||
1748 | [58; 64) 'vtable': Vtable | ||
1749 | [67; 91) 'Vtable...| {} }': Vtable | ||
1750 | [84; 89) '|| {}': || -> () | ||
1751 | [87; 89) '{}': () | ||
1752 | [101; 102) 'm': fn() -> () | ||
1753 | [105; 111) 'vtable': Vtable | ||
1754 | [105; 118) 'vtable.method': fn() -> () | ||
1755 | "### | ||
1756 | ); | ||
1757 | } | ||