From 44b00aed4a7d7e329fcbfa95a8685437cfb06e41 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Fri, 20 Dec 2019 18:53:40 +0100 Subject: Coerce closures to fn pointers E.g. `let x: fn(A) -> B = |x| { y };` --- crates/ra_hir_ty/src/infer/coerce.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'crates/ra_hir_ty/src/infer') 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> { } } + (ty_app!(TypeCtor::Closure { .. }, params), ty_app!(TypeCtor::FnPtr { .. })) => { + from_ty = params[0].clone(); + } + _ => {} } -- cgit v1.2.3