Replace walk with visit so we dont skip outermost expr kind in def collector

This commit is contained in:
Michael Goulet 2024-09-01 11:16:50 -04:00
parent 1a1cc050d8
commit 7ab44cddc9
2 changed files with 13 additions and 1 deletions

View file

@ -223,7 +223,7 @@ impl<'a, 'b, 'tcx> visit::Visitor<'a> for DefCollector<'a, 'b, 'tcx> {
// we must create two defs.
let coroutine_def =
self.create_def(coroutine_kind.closure_id(), kw::Empty, DefKind::Closure, span);
self.with_parent(coroutine_def, |this| visit::walk_expr(this, body));
self.with_parent(coroutine_def, |this| this.visit_expr(body));
}
_ => visit::walk_fn(self, fn_kind),
}