Parse inner attributes on inline const block
This commit is contained in:
parent
52b34550ac
commit
f427698c03
4 changed files with 26 additions and 6 deletions
|
@ -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).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue