Skip to content

Commit a732c3a

Browse files
Rollup merge of #78853 - calebcartwright:fix-const-block-expr-span, r=spastorino
rustc_parse: fix ConstBlock expr span The span for a ConstBlock expression should presumably run through the end of the block it contains and not stop at the keyword, just like is done with similar block-containing expression kinds, such as a TryBlock
2 parents 772b1a6 + e1d5c3c commit a732c3a

File tree

1 file changed

+2
-1
lines changed
  • compiler/rustc_parse/src/parser

1 file changed

+2
-1
lines changed

compiler/rustc_parse/src/parser/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,8 @@ impl<'a> Parser<'a> {
873873
id: DUMMY_NODE_ID,
874874
value: self.mk_expr(blk.span, ExprKind::Block(blk, None), AttrVec::new()),
875875
};
876-
Ok(self.mk_expr(span, ExprKind::ConstBlock(anon_const), AttrVec::new()))
876+
let blk_span = anon_const.value.span;
877+
Ok(self.mk_expr(span.to(blk_span), ExprKind::ConstBlock(anon_const), AttrVec::new()))
877878
}
878879

879880
/// Parses mutability (`mut` or nothing).

0 commit comments

Comments
 (0)