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
This commit is contained in:
Jonas Schievink 2020-11-28 15:58:15 +01:00 committed by GitHub
commit a732c3a369
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -873,7 +873,8 @@ fn parse_const_block(&mut self, span: Span) -> PResult<'a, P<Expr>> {
id: DUMMY_NODE_ID,
value: self.mk_expr(blk.span, ExprKind::Block(blk, None), AttrVec::new()),
};
Ok(self.mk_expr(span, ExprKind::ConstBlock(anon_const), AttrVec::new()))
let blk_span = anon_const.value.span;
Ok(self.mk_expr(span.to(blk_span), ExprKind::ConstBlock(anon_const), AttrVec::new()))
}
/// Parses mutability (`mut` or nothing).