1
Fork 0

Preserve yield position during pretty printing

This commit is contained in:
Eric Holk 2025-03-12 16:27:52 -07:00
parent edf65e735c
commit 1c0916a2b3
No known key found for this signature in database
GPG key ID: F1A772BB658A63E1
12 changed files with 55 additions and 18 deletions

View file

@ -351,7 +351,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
rest,
)
}
ExprKind::Yield(opt_expr) => self.lower_expr_yield(e.span, opt_expr.as_deref()),
ExprKind::Yield(opt_expr, _) => self.lower_expr_yield(e.span, opt_expr.as_deref()),
ExprKind::Err(guar) => hir::ExprKind::Err(*guar),
ExprKind::UnsafeBinderCast(kind, expr, ty) => hir::ExprKind::UnsafeBinderCast(

View file

@ -642,7 +642,7 @@ fn may_contain_yield_point(e: &ast::Expr) -> bool {
type Result = ControlFlow<()>;
fn visit_expr(&mut self, e: &ast::Expr) -> ControlFlow<()> {
if let ast::ExprKind::Await(_, _) | ast::ExprKind::Yield(_) = e.kind {
if let ast::ExprKind::Await(_, _) | ast::ExprKind::Yield(_, _) = e.kind {
ControlFlow::Break(())
} else {
visit::walk_expr(self, e)