aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/infer/coerce.rs
diff options
context:
space:
mode:
authoradamrk <[email protected]>2020-06-20 07:13:14 +0100
committeradamrk <[email protected]>2020-06-20 07:26:31 +0100
commitcf870af8073e3a72fdfb1d36b017f0abd7593559 (patch)
treedeeda64f2aeafeaf0e8aed47da226f62f221a4eb /crates/ra_hir_ty/src/infer/coerce.rs
parent3f94a90c7bbc1b3116a7960ae9f25ebe35d68ad0 (diff)
Switch back callable_sig for known fn types
Diffstat (limited to 'crates/ra_hir_ty/src/infer/coerce.rs')
-rw-r--r--crates/ra_hir_ty/src/infer/coerce.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_hir_ty/src/infer/coerce.rs b/crates/ra_hir_ty/src/infer/coerce.rs
index 4c5f171de..32c7c57cd 100644
--- a/crates/ra_hir_ty/src/infer/coerce.rs
+++ b/crates/ra_hir_ty/src/infer/coerce.rs
@@ -38,8 +38,8 @@ impl<'a> InferenceContext<'a> {
38 // Special case: two function types. Try to coerce both to 38 // Special case: two function types. Try to coerce both to
39 // pointers to have a chance at getting a match. See 39 // pointers to have a chance at getting a match. See
40 // https://github.com/rust-lang/rust/blob/7b805396bf46dce972692a6846ce2ad8481c5f85/src/librustc_typeck/check/coercion.rs#L877-L916 40 // https://github.com/rust-lang/rust/blob/7b805396bf46dce972692a6846ce2ad8481c5f85/src/librustc_typeck/check/coercion.rs#L877-L916
41 let sig1 = self.callable_sig(ty1).expect("FnDef without callable sig"); 41 let sig1 = ty1.callable_sig(self.db).expect("FnDef without callable sig");
42 let sig2 = self.callable_sig(ty2).expect("FnDef without callable sig"); 42 let sig2 = ty2.callable_sig(self.db).expect("FnDef without callable sig");
43 let ptr_ty1 = Ty::fn_ptr(sig1); 43 let ptr_ty1 = Ty::fn_ptr(sig1);
44 let ptr_ty2 = Ty::fn_ptr(sig2); 44 let ptr_ty2 = Ty::fn_ptr(sig2);
45 self.coerce_merge_branch(&ptr_ty1, &ptr_ty2) 45 self.coerce_merge_branch(&ptr_ty1, &ptr_ty2)
@@ -93,7 +93,7 @@ impl<'a> InferenceContext<'a> {
93 93
94 // `{function_type}` -> `fn()` 94 // `{function_type}` -> `fn()`
95 (ty_app!(TypeCtor::FnDef(_)), ty_app!(TypeCtor::FnPtr { .. })) => { 95 (ty_app!(TypeCtor::FnDef(_)), ty_app!(TypeCtor::FnPtr { .. })) => {
96 match self.callable_sig(&from_ty) { 96 match from_ty.callable_sig(self.db) {
97 None => return false, 97 None => return false,
98 Some(sig) => { 98 Some(sig) => {
99 from_ty = Ty::fn_ptr(sig); 99 from_ty = Ty::fn_ptr(sig);