diff options
| author | Jonas Schievink <jonasschievink@gmail.com> | 2020-11-28 15:58:15 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-28 15:58:15 +0100 |
| commit | a732c3a3693fab727d3b8e6f5594b67efbb421eb (patch) | |
| tree | 660baa930905d1140eab240f77232979ee1fe8a9 | |
| parent | 772b1a6d79e3deaf4326b144e58f147088963ff7 (diff) | |
| parent | e1d5c3c0544b981c08581a0cf40c759d2f5bdff0 (diff) | |
| download | rust-a732c3a3693fab727d3b8e6f5594b67efbb421eb.tar.gz rust-a732c3a3693fab727d3b8e6f5594b67efbb421eb.zip | |
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
| -rw-r--r-- | compiler/rustc_parse/src/parser/mod.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index 2a779c37b89..b746256f5fe 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -873,7 +873,8 @@ impl<'a> Parser<'a> { 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). |
