Skip to content

Commit cf870af

Browse files
committed
Switch back callable_sig for known fn types
1 parent 3f94a90 commit cf870af

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

crates/ra_hir_ty/src/infer/coerce.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ impl<'a> InferenceContext<'a> {
3838
// Special case: two function types. Try to coerce both to
3939
// pointers to have a chance at getting a match. See
4040
// 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");
42-
let sig2 = self.callable_sig(ty2).expect("FnDef without callable sig");
41+
let sig1 = ty1.callable_sig(self.db).expect("FnDef without callable sig");
42+
let sig2 = ty2.callable_sig(self.db).expect("FnDef without callable sig");
4343
let ptr_ty1 = Ty::fn_ptr(sig1);
4444
let ptr_ty2 = Ty::fn_ptr(sig2);
4545
self.coerce_merge_branch(&ptr_ty1, &ptr_ty2)
@@ -93,7 +93,7 @@ impl<'a> InferenceContext<'a> {
9393

9494
// `{function_type}` -> `fn()`
9595
(ty_app!(TypeCtor::FnDef(_)), ty_app!(TypeCtor::FnPtr { .. })) => {
96-
match self.callable_sig(&from_ty) {
96+
match from_ty.callable_sig(self.db) {
9797
None => return false,
9898
Some(sig) => {
9999
from_ty = Ty::fn_ptr(sig);

crates/ra_hir_ty/src/infer/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ impl<'a> InferenceContext<'a> {
768768
let method_ty = method_ty.subst(&substs);
769769
let method_ty = self.insert_type_vars(method_ty);
770770
self.register_obligations_for_call(&method_ty);
771-
let (expected_receiver_ty, param_tys, ret_ty) = match self.callable_sig(&method_ty) {
771+
let (expected_receiver_ty, param_tys, ret_ty) = match method_ty.callable_sig(self.db) {
772772
Some(sig) => {
773773
if !sig.params().is_empty() {
774774
(sig.params()[0].clone(), sig.params()[1..].to_vec(), sig.ret().clone())

0 commit comments

Comments
 (0)