aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/infer/expr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/infer/expr.rs')
-rw-r--r--crates/hir_ty/src/infer/expr.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs
index 13240f790..b75d32b85 100644
--- a/crates/hir_ty/src/infer/expr.rs
+++ b/crates/hir_ty/src/infer/expr.rs
@@ -18,8 +18,8 @@ use crate::{
18 primitive::{self, UintTy}, 18 primitive::{self, UintTy},
19 traits::{FnTrait, InEnvironment}, 19 traits::{FnTrait, InEnvironment},
20 utils::{generics, variant_data, Generics}, 20 utils::{generics, variant_data, Generics},
21 Binders, CallableDefId, InferTy, Mutability, Obligation, OpaqueTyId, Rawness, Scalar, Substs, 21 Binders, CallableDefId, FnPointer, FnSig, InferTy, Mutability, Obligation, OpaqueTyId, Rawness,
22 TraitRef, Ty, 22 Scalar, Substs, TraitRef, Ty,
23}; 23};
24 24
25use super::{ 25use super::{
@@ -247,13 +247,12 @@ impl<'a> InferenceContext<'a> {
247 None => self.table.new_type_var(), 247 None => self.table.new_type_var(),
248 }; 248 };
249 sig_tys.push(ret_ty.clone()); 249 sig_tys.push(ret_ty.clone());
250 let sig_ty = Ty::FnPtr { 250 let sig_ty = Ty::Function(FnPointer {
251 num_args: sig_tys.len() as u16 - 1, 251 num_args: sig_tys.len() - 1,
252 is_varargs: false, 252 sig: FnSig { variadic: false },
253 substs: Substs(sig_tys.clone().into()), 253 substs: Substs(sig_tys.clone().into()),
254 }; 254 });
255 let closure_ty = 255 let closure_ty = Ty::Closure(self.owner, tgt_expr, Substs::single(sig_ty));
256 Ty::Closure { def: self.owner, expr: tgt_expr, substs: Substs::single(sig_ty) };
257 256
258 // Eagerly try to relate the closure type with the expected 257 // Eagerly try to relate the closure type with the expected
259 // type, otherwise we often won't have enough information to 258 // type, otherwise we often won't have enough information to