Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/expr_store/lower.rs')
-rw-r--r--crates/hir-def/src/expr_store/lower.rs66
1 files changed, 36 insertions, 30 deletions
diff --git a/crates/hir-def/src/expr_store/lower.rs b/crates/hir-def/src/expr_store/lower.rs
index 5cbcfe5f23..41edca07c7 100644
--- a/crates/hir-def/src/expr_store/lower.rs
+++ b/crates/hir-def/src/expr_store/lower.rs
@@ -1364,16 +1364,18 @@ impl<'db> ExprCollector<'db> {
let capture_by =
if e.move_token().is_some() { CaptureBy::Value } else { CaptureBy::Ref };
self.with_label_rib(RibKind::Closure, |this| {
- this.with_awaitable_block(Awaitable::Yes, |this| {
- this.collect_block_(e, |this, id, statements, tail| {
- this.desugared_coroutine_expr(
- CoroutineKind::Async,
- CoroutineSource::Block,
- capture_by,
- id,
- statements,
- tail,
- )
+ this.with_binding_owner(|this| {
+ this.with_awaitable_block(Awaitable::Yes, |this| {
+ this.collect_block_(e, |this, id, statements, tail| {
+ this.desugared_coroutine_expr(
+ CoroutineKind::Async,
+ CoroutineSource::Block,
+ capture_by,
+ id,
+ statements,
+ tail,
+ )
+ })
})
})
})
@@ -1382,16 +1384,18 @@ impl<'db> ExprCollector<'db> {
let capture_by =
if e.move_token().is_some() { CaptureBy::Value } else { CaptureBy::Ref };
self.with_label_rib(RibKind::Closure, |this| {
- this.with_awaitable_block(Awaitable::No("non-async gen block"), |this| {
- this.collect_block_(e, |this, id, statements, tail| {
- this.desugared_coroutine_expr(
- CoroutineKind::Gen,
- CoroutineSource::Block,
- capture_by,
- id,
- statements,
- tail,
- )
+ this.with_binding_owner(|this| {
+ this.with_awaitable_block(Awaitable::No("non-async gen block"), |this| {
+ this.collect_block_(e, |this, id, statements, tail| {
+ this.desugared_coroutine_expr(
+ CoroutineKind::Gen,
+ CoroutineSource::Block,
+ capture_by,
+ id,
+ statements,
+ tail,
+ )
+ })
})
})
})
@@ -1400,16 +1404,18 @@ impl<'db> ExprCollector<'db> {
let capture_by =
if e.move_token().is_some() { CaptureBy::Value } else { CaptureBy::Ref };
self.with_label_rib(RibKind::Closure, |this| {
- this.with_awaitable_block(Awaitable::Yes, |this| {
- this.collect_block_(e, |this, id, statements, tail| {
- this.desugared_coroutine_expr(
- CoroutineKind::AsyncGen,
- CoroutineSource::Block,
- capture_by,
- id,
- statements,
- tail,
- )
+ this.with_binding_owner(|this| {
+ this.with_awaitable_block(Awaitable::Yes, |this| {
+ this.collect_block_(e, |this, id, statements, tail| {
+ this.desugared_coroutine_expr(
+ CoroutineKind::AsyncGen,
+ CoroutineSource::Block,
+ capture_by,
+ id,
+ statements,
+ tail,
+ )
+ })
})
})
})