diff options
| author | David Tolnay <dtolnay@gmail.com> | 2022-03-15 17:20:21 -0700 |
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2022-03-15 17:56:59 -0700 |
| commit | f427698c03a74b961dbc5f28bc7a9801a77d0d44 (patch) | |
| tree | 72ad624ce85a93a8a64633d529eecd4977457f24 /compiler/rustc_parse/src/parser | |
| parent | 52b34550aca5f7dd7e152f773e3ab786acb86f6f (diff) | |
| download | rust-f427698c03a74b961dbc5f28bc7a9801a77d0d44.tar.gz rust-f427698c03a74b961dbc5f28bc7a9801a77d0d44.zip | |
Parse inner attributes on inline const block
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/mod.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index 4e229918b63..ffa4f7fed2d 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -1105,13 +1105,13 @@ impl<'a> Parser<'a> { self.sess.gated_spans.gate(sym::inline_const, span); } self.eat_keyword(kw::Const); - let blk = self.parse_block()?; + let (attrs, blk) = self.parse_inner_attrs_and_block()?; let anon_const = AnonConst { id: DUMMY_NODE_ID, value: self.mk_expr(blk.span, ExprKind::Block(blk, None), AttrVec::new()), }; let blk_span = anon_const.value.span; - Ok(self.mk_expr(span.to(blk_span), ExprKind::ConstBlock(anon_const), AttrVec::new())) + Ok(self.mk_expr(span.to(blk_span), ExprKind::ConstBlock(anon_const), AttrVec::from(attrs))) } /// Parses mutability (`mut` or nothing). |
