about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-10-01 00:58:30 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-10-01 01:10:12 +0300
commit6ea4a52f47f3f66f9db9004d8ed55a819dd81523 (patch)
tree2c31b5b563ee076e13ab2b223899a4db7aa11374
parent957986d05620238799ae7053d505f742a0c7d640 (diff)
downloadrust-6ea4a52f47f3f66f9db9004d8ed55a819dd81523.tar.gz
rust-6ea4a52f47f3f66f9db9004d8ed55a819dd81523.zip
Address review comments
-rw-r--r--src/libsyntax/ast.rs1
-rw-r--r--src/libsyntax/parse/attr.rs4
-rw-r--r--src/test/ui/macros/macro-meta-items-modern.rs11
3 files changed, 14 insertions, 2 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index e2c8e37e11c..023952042e6 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.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 }
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs
index f3298b6a65d..e74f3045db8 100644
--- a/src/libsyntax/parse/attr.rs
+++ b/src/libsyntax/parse/attr.rs
@@ -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 {
diff --git a/src/test/ui/macros/macro-meta-items-modern.rs b/src/test/ui/macros/macro-meta-items-modern.rs
new file mode 100644
index 00000000000..bc6938d4a6c
--- /dev/null
+++ b/src/test/ui/macros/macro-meta-items-modern.rs
@@ -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() {}