Skip to content
Permalink
Browse files

Address review comments

  • Loading branch information...
petrochenkov committed Sep 30, 2019
1 parent 957986d commit 6ea4a52f47f3f66f9db9004d8ed55a819dd81523
Showing with 14 additions and 2 deletions.
  1. +1 −0 src/libsyntax/ast.rs
  2. +2 −2 src/libsyntax/parse/attr.rs
  3. +11 −0 src/test/ui/macros/macro-meta-items-modern.rs
@@ -2156,6 +2156,7 @@ pub struct Attribute {
pub span: Span,
}

// Compatibility impl to avoid churn, consider removing.
impl std::ops::Deref for Attribute {
type Target = AttrItem;
fn deref(&self) -> &Self::Target { &self.item }
@@ -166,7 +166,7 @@ impl<'a> Parser<'a> {
/// PATH `[` TOKEN_STREAM `]`
/// PATH `{` TOKEN_STREAM `}`
/// PATH
/// PATH `=` TOKEN_TREE
/// PATH `=` UNSUFFIXED_LIT
/// The delimiters or `=` are still put into the resulting token stream.
pub fn parse_attr_item(&mut self) -> PResult<'a, ast::AttrItem> {
let item = match self.token.kind {
@@ -262,7 +262,7 @@ impl<'a> Parser<'a> {

/// Matches the following grammar (per RFC 1559).
///
/// meta_item : IDENT ( '=' UNSUFFIXED_LIT | '(' meta_item_inner? ')' )? ;
/// meta_item : PATH ( '=' UNSUFFIXED_LIT | '(' meta_item_inner? ')' )? ;
/// meta_item_inner : (meta_item | UNSUFFIXED_LIT) (',' meta_item_inner)? ;
pub fn parse_meta_item(&mut self) -> PResult<'a, ast::MetaItem> {
let nt_meta = match self.token.kind {
@@ -0,0 +1,11 @@
// check-pass

macro_rules! check { ($meta:meta) => () }

check!(meta(a b c d));
check!(meta[a b c d]);
check!(meta { a b c d });
check!(meta);
check!(meta = 0);

fn main() {}

0 comments on commit 6ea4a52

Please sign in to comment.
You can’t perform that action at this time.