]> git.lizzy.rs Git - rust.git/commitdiff
Do not include attributes in trait item spans.
authorNick Cameron <ncameron@mozilla.com>
Thu, 23 Apr 2015 20:45:32 +0000 (08:45 +1200)
committerNick Cameron <ncameron@mozilla.com>
Thu, 23 Apr 2015 20:45:32 +0000 (08:45 +1200)
(And other kinds of items).

src/libsyntax/parse/parser.rs

index dc577f603f621903a1608f4b7edd1a9b2e87ecde..68006a8979a6468c702fe7d0497a869d830c9e52 100644 (file)
@@ -1151,8 +1151,8 @@ pub fn parse_trait_items(&mut self) -> PResult<Vec<P<TraitItem>>> {
             &token::CloseDelim(token::Brace),
             seq_sep_none(),
             |p| {
-            let lo = p.span.lo;
             let mut attrs = p.parse_outer_attributes();
+            let lo = p.span.lo;
 
             let (name, node) = if try!(p.eat_keyword(keywords::Type)) {
                 let TyParam {ident, bounds, default, ..} = try!(p.parse_ty_param());
@@ -3409,8 +3409,8 @@ fn check_expected_item(p: &mut Parser, attrs: &[Attribute]) {
             }
         }
 
-        let lo = self.span.lo;
         let attrs = self.parse_outer_attributes();
+        let lo = self.span.lo;
 
         Ok(Some(if self.check_keyword(keywords::Let) {
             check_expected_item(self, &attrs);
@@ -4304,8 +4304,8 @@ fn parse_item_fn(&mut self, unsafety: Unsafety, abi: abi::Abi) -> PResult<ItemIn
 
     /// Parse an impl item.
     pub fn parse_impl_item(&mut self) -> PResult<P<ImplItem>> {
-        let lo = self.span.lo;
         let mut attrs = self.parse_outer_attributes();
+        let lo = self.span.lo;
         let vis = try!(self.parse_visibility());
         let (name, node) = if try!(self.eat_keyword(keywords::Type)) {
             let name = try!(self.parse_ident());
@@ -5380,9 +5380,8 @@ fn parse_item_(&mut self, attrs: Vec<Attribute>,
 
     /// Parse a foreign item.
     fn parse_foreign_item(&mut self) -> PResult<Option<P<ForeignItem>>> {
-        let lo = self.span.lo;
-
         let attrs = self.parse_outer_attributes();
+        let lo = self.span.lo;
         let visibility = try!(self.parse_visibility());
 
         if self.check_keyword(keywords::Static) {