diff options
| author | Eric Holk <ericholk@microsoft.com> | 2025-03-17 17:32:11 -0700 |
|---|---|---|
| committer | Eric Holk <ericholk@microsoft.com> | 2025-03-17 17:32:11 -0700 |
| commit | 9b0e7f62644b629c30b4157ad854296eca36ecf0 (patch) | |
| tree | ec26352afcd7a8c995bbe1c8115664af0a5d07e3 /compiler/rustc_parse/src/parser/expr.rs | |
| parent | c5093ac1224fe9eeff5c5694f1c3ff643005d7d4 (diff) | |
| download | rust-9b0e7f62644b629c30b4157ad854296eca36ecf0.tar.gz rust-9b0e7f62644b629c30b4157ad854296eca36ecf0.zip | |
Teach rustfmt to handle postfix yield
This involved fixing the span when parsing .yield
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index cb04bbc240e..28d100074f3 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -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; |
