From 789ee88bd015fde4257464d0120ab57b0d744e0b Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Thu, 27 Jun 2024 14:56:57 -0400 Subject: Tighten spans for async blocks --- compiler/rustc_parse/src/parser/expr.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'compiler/rustc_parse/src/parser') diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index e0c70884fee..3cdc20b6c65 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -3432,8 +3432,9 @@ impl<'a> Parser<'a> { } } let capture_clause = self.parse_capture_clause()?; + let decl_span = lo.to(self.prev_token.span); let (attrs, body) = self.parse_inner_attrs_and_block()?; - let kind = ExprKind::Gen(capture_clause, body, kind); + let kind = ExprKind::Gen(capture_clause, body, kind, decl_span); Ok(self.mk_expr_with_attrs(lo.to(self.prev_token.span), kind, attrs)) } @@ -4022,7 +4023,7 @@ impl MutVisitor for CondChecker<'_> { | ExprKind::Match(_, _, _) | ExprKind::Closure(_) | ExprKind::Block(_, _) - | ExprKind::Gen(_, _, _) + | ExprKind::Gen(_, _, _, _) | ExprKind::TryBlock(_) | ExprKind::Underscore | ExprKind::Path(_, _) -- cgit 1.4.1-3-g733a5