1
Fork 0

Teach rustfmt to handle postfix yield

This involved fixing the span when parsing .yield
This commit is contained in:
Eric Holk 2025-03-17 17:32:11 -07:00
parent c5093ac122
commit 9b0e7f6264
No known key found for this signature in database
GPG key ID: F1A772BB658A63E1
5 changed files with 23 additions and 24 deletions

View file

@ -1315,9 +1315,8 @@ impl<'a> Parser<'a> {
if self.eat_keyword(exp!(Yield)) {
let yield_span = self.prev_token.span;
self.psess.gated_spans.gate(sym::yield_expr, yield_span);
return Ok(
self.mk_expr(yield_span, ExprKind::Yield(Some(self_arg), YieldKind::Postfix))
);
return Ok(self
.mk_expr(lo.to(yield_span), ExprKind::Yield(Some(self_arg), YieldKind::Postfix)));
}
let fn_span_lo = self.token.span;