Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/infer/closure.rs')
-rw-r--r--crates/hir-ty/src/infer/closure.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/crates/hir-ty/src/infer/closure.rs b/crates/hir-ty/src/infer/closure.rs
index f5b974b1db..f90f135919 100644
--- a/crates/hir-ty/src/infer/closure.rs
+++ b/crates/hir-ty/src/infer/closure.rs
@@ -95,6 +95,8 @@ impl<'db> InferenceContext<'_, 'db> {
let tupled_upvars_ty = self.table.next_ty_var(closure_expr.into());
+ let closure_loc =
+ InternedClosure { owner: self.owner, expr: closure_expr, kind: closure_kind };
// FIXME: We could probably actually just unify this further --
// instead of having a `FnSig` and a `Option<CoroutineTypes>`,
// we can have a `ClosureSignature { Coroutine { .. }, Closure { .. } }`,
@@ -132,8 +134,7 @@ impl<'db> InferenceContext<'_, 'db> {
},
);
- let closure_id =
- InternedClosureId::new(self.db, InternedClosure(self.owner, closure_expr));
+ let closure_id = InternedClosureId::new(self.db, closure_loc);
(Ty::new_closure(interner, closure_id.into(), closure_args.args), None)
}
@@ -183,8 +184,7 @@ impl<'db> InferenceContext<'_, 'db> {
},
);
- let coroutine_id =
- InternedCoroutineId::new(self.db, InternedClosure(self.owner, closure_expr));
+ let coroutine_id = InternedCoroutineId::new(self.db, closure_loc);
(
Ty::new_coroutine(interner, coroutine_id.into(), coroutine_args.args),
@@ -256,10 +256,7 @@ impl<'db> InferenceContext<'_, 'db> {
let coroutine_upvars_ty = self.table.next_ty_var(closure_expr.into());
- let coroutine_closure_id = InternedCoroutineClosureId::new(
- self.db,
- InternedClosure(self.owner, closure_expr),
- );
+ let coroutine_closure_id = InternedCoroutineClosureId::new(self.db, closure_loc);
// We need to turn the liberated signature that we got from HIR, which
// looks something like `|Args...| -> T`, into a signature that is suitable