diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-12-20 17:58:59 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-12-20 17:58:59 +0000 |
commit | 979cbb496e88f91d21a1f12cbf959fc0032bd0cd (patch) | |
tree | 0b00ef7d63064a4f60e03427abf0803bb17b4596 /crates/ra_hir_ty/src/infer | |
parent | 1d7931e5ffeb2d65ebcc14a63da1b84cc131bfb8 (diff) | |
parent | 44b00aed4a7d7e329fcbfa95a8685437cfb06e41 (diff) |
Merge #2619
2619: Coerce closures to fn pointers r=flodiebold a=flodiebold
E.g. `let x: fn(A) -> B = |x| { y };`
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty/src/infer')
-rw-r--r-- | crates/ra_hir_ty/src/infer/coerce.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/infer/coerce.rs b/crates/ra_hir_ty/src/infer/coerce.rs index 0f4dac45e..83c0c2c3f 100644 --- a/crates/ra_hir_ty/src/infer/coerce.rs +++ b/crates/ra_hir_ty/src/infer/coerce.rs | |||
@@ -134,6 +134,10 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
137 | (ty_app!(TypeCtor::Closure { .. }, params), ty_app!(TypeCtor::FnPtr { .. })) => { | ||
138 | from_ty = params[0].clone(); | ||
139 | } | ||
140 | |||
137 | _ => {} | 141 | _ => {} |
138 | } | 142 | } |
139 | 143 | ||