aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/infer/expr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty/infer/expr.rs')
-rw-r--r--crates/ra_hir/src/ty/infer/expr.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/crates/ra_hir/src/ty/infer/expr.rs b/crates/ra_hir/src/ty/infer/expr.rs
index 4af1d65ee..c6802487a 100644
--- a/crates/ra_hir/src/ty/infer/expr.rs
+++ b/crates/ra_hir/src/ty/infer/expr.rs
@@ -130,10 +130,8 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
130 TypeCtor::FnPtr { num_args: sig_tys.len() as u16 - 1 }, 130 TypeCtor::FnPtr { num_args: sig_tys.len() as u16 - 1 },
131 Substs(sig_tys.into()), 131 Substs(sig_tys.into()),
132 ); 132 );
133 let closure_ty = Ty::apply_one( 133 let closure_ty =
134 TypeCtor::Closure { def: self.body.owner(), expr: tgt_expr }, 134 Ty::apply_one(TypeCtor::Closure { def: self.owner, expr: tgt_expr }, sig_ty);
135 sig_ty,
136 );
137 135
138 // Eagerly try to relate the closure type with the expected 136 // Eagerly try to relate the closure type with the expected
139 // type, otherwise we often won't have enough information to 137 // type, otherwise we often won't have enough information to
@@ -184,7 +182,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
184 } 182 }
185 Expr::Path(p) => { 183 Expr::Path(p) => {
186 // FIXME this could be more efficient... 184 // FIXME this could be more efficient...
187 let resolver = expr::resolver_for_expr(self.body.clone(), self.db, tgt_expr); 185 let resolver = expr::resolver_for_expr(self.db, self.owner, tgt_expr);
188 self.infer_path(&resolver, p, tgt_expr.into()).unwrap_or(Ty::Unknown) 186 self.infer_path(&resolver, p, tgt_expr.into()).unwrap_or(Ty::Unknown)
189 } 187 }
190 Expr::Continue => Ty::simple(TypeCtor::Never), 188 Expr::Continue => Ty::simple(TypeCtor::Never),
@@ -452,8 +450,8 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
452 Ty::apply_one(TypeCtor::Ref(Mutability::Shared), slice_type) 450 Ty::apply_one(TypeCtor::Ref(Mutability::Shared), slice_type)
453 } 451 }
454 Literal::Char(..) => Ty::simple(TypeCtor::Char), 452 Literal::Char(..) => Ty::simple(TypeCtor::Char),
455 Literal::Int(_v, ty) => Ty::simple(TypeCtor::Int(*ty)), 453 Literal::Int(_v, ty) => Ty::simple(TypeCtor::Int((*ty).into())),
456 Literal::Float(_v, ty) => Ty::simple(TypeCtor::Float(*ty)), 454 Literal::Float(_v, ty) => Ty::simple(TypeCtor::Float((*ty).into())),
457 }, 455 },
458 }; 456 };
459 // use a new type variable if we got Ty::Unknown here 457 // use a new type variable if we got Ty::Unknown here