diff options
author | Florian Diebold <[email protected]> | 2019-12-20 17:53:40 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-12-20 17:54:33 +0000 |
commit | 44b00aed4a7d7e329fcbfa95a8685437cfb06e41 (patch) | |
tree | 0b00ef7d63064a4f60e03427abf0803bb17b4596 /crates/ra_hir_ty/src/infer | |
parent | 1d7931e5ffeb2d65ebcc14a63da1b84cc131bfb8 (diff) |
Coerce closures to fn pointers
E.g. `let x: fn(A) -> B = |x| { y };`
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 | ||