about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorBenjamin Saunders <ben.e.saunders@gmail.com>2017-01-03 19:13:01 -0800
committerBenjamin Saunders <ben.e.saunders@gmail.com>2017-01-11 21:33:17 -0800
commit7972c1905beb9d1169475f42231b25d0bc9e83e6 (patch)
treecc72ed09a2553aab5e384c305ff850844c607d8d /src/libsyntax/parse/parser.rs
parent8f62c2920077eb5cb81323142fc5dbe6ae8813c0 (diff)
downloadrust-7972c1905beb9d1169475f42231b25d0bc9e83e6.tar.gz
rust-7972c1905beb9d1169475f42231b25d0bc9e83e6.zip
syntax: struct field attributes and cfg
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
-rw-r--r--src/libsyntax/parse/parser.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 2bb38433a26..167fa78d7e0 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -1946,6 +1946,7 @@ impl<'a> Parser<'a> {
 
     /// Parse ident (COLON expr)?
     pub fn parse_field(&mut self) -> PResult<'a, Field> {
+        let attrs = self.parse_outer_attributes()?;
         let lo = self.span.lo;
         let hi;
 
@@ -1968,6 +1969,7 @@ impl<'a> Parser<'a> {
             span: mk_sp(lo, expr.span.hi),
             expr: expr,
             is_shorthand: is_shorthand,
+            attrs: attrs.into(),
         })
     }
 
@@ -3436,6 +3438,7 @@ impl<'a> Parser<'a> {
                 if self.check(&token::CloseDelim(token::Brace)) { break }
             }
 
+            let attrs = self.parse_outer_attributes()?;
             let lo = self.span.lo;
             let hi;
 
@@ -3493,9 +3496,13 @@ impl<'a> Parser<'a> {
             };
 
             fields.push(codemap::Spanned { span: mk_sp(lo, hi),
-                                              node: ast::FieldPat { ident: fieldname,
-                                                                    pat: subpat,
-                                                                    is_shorthand: is_shorthand }});
+                                           node: ast::FieldPat {
+                                               ident: fieldname,
+                                               pat: subpat,
+                                               is_shorthand: is_shorthand,
+                                               attrs: attrs.into(),
+                                           }
+            });
         }
         return Ok((fields, etc));
     }