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.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs
index 153f22f25..eee3e6ec5 100644
--- a/crates/hir_ty/src/infer/expr.rs
+++ b/crates/hir_ty/src/infer/expr.rs
@@ -21,8 +21,8 @@ use crate::{
21 to_assoc_type_id, 21 to_assoc_type_id,
22 traits::{chalk::from_chalk, FnTrait, InEnvironment}, 22 traits::{chalk::from_chalk, FnTrait, InEnvironment},
23 utils::{generics, variant_data, Generics}, 23 utils::{generics, variant_data, Generics},
24 AdtId, Binders, CallableDefId, FnPointer, FnSig, Interner, Obligation, OpaqueTyId, Rawness, 24 AdtId, Binders, CallableDefId, FnPointer, FnSig, Interner, Obligation, Rawness, Scalar, Substs,
25 Scalar, Substs, TraitRef, Ty, TyKind, 25 TraitRef, Ty, TyKind,
26}; 26};
27 27
28use super::{ 28use super::{
@@ -179,7 +179,8 @@ impl<'a> InferenceContext<'a> {
179 // Use the first type parameter as the output type of future. 179 // Use the first type parameter as the output type of future.
180 // existenail type AsyncBlockImplTrait<InnerType>: Future<Output = InnerType> 180 // existenail type AsyncBlockImplTrait<InnerType>: Future<Output = InnerType>
181 let inner_ty = self.infer_expr(*body, &Expectation::none()); 181 let inner_ty = self.infer_expr(*body, &Expectation::none());
182 let opaque_ty_id = OpaqueTyId::AsyncBlockTypeImplTrait(self.owner, *body); 182 let impl_trait_id = crate::ImplTraitId::AsyncBlockTypeImplTrait(self.owner, *body);
183 let opaque_ty_id = self.db.intern_impl_trait_id(impl_trait_id).into();
183 TyKind::OpaqueType(opaque_ty_id, Substs::single(inner_ty)).intern(&Interner) 184 TyKind::OpaqueType(opaque_ty_id, Substs::single(inner_ty)).intern(&Interner)
184 } 185 }
185 Expr::Loop { body, label } => { 186 Expr::Loop { body, label } => {
@@ -264,8 +265,9 @@ impl<'a> InferenceContext<'a> {
264 substs: Substs(sig_tys.clone().into()), 265 substs: Substs(sig_tys.clone().into()),
265 }) 266 })
266 .intern(&Interner); 267 .intern(&Interner);
268 let closure_id = self.db.intern_closure((self.owner, tgt_expr)).into();
267 let closure_ty = 269 let closure_ty =
268 TyKind::Closure(self.owner, tgt_expr, Substs::single(sig_ty)).intern(&Interner); 270 TyKind::Closure(closure_id, Substs::single(sig_ty)).intern(&Interner);
269 271
270 // Eagerly try to relate the closure type with the expected 272 // Eagerly try to relate the closure type with the expected
271 // type, otherwise we often won't have enough information to 273 // type, otherwise we often won't have enough information to