diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-13 19:08:29 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-13 19:08:29 +0000 |
commit | 17eeb2a6d2ea81b302b6707c63bf8fba489c2bdd (patch) | |
tree | a2e152f5f16dd92f4c4be011be2399998dc7eb6f /crates/hir_ty/src/infer/expr.rs | |
parent | be7a31fbd64943f71afe11b0413c99496526dddc (diff) | |
parent | b035c314b4b0ecd2477fde216dbe7e8801f94d0d (diff) |
Merge #8001
8001: More Chalk IDs r=flodiebold a=flodiebold
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/infer/expr.rs')
-rw-r--r-- | crates/hir_ty/src/infer/expr.rs | 10 |
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 | ||
28 | use super::{ | 28 | use 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 |