diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2015-04-24 09:48:18 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2015-04-24 09:48:18 +0530 |
| commit | 5a61d43526b97d864b68a98008837a09629f2573 (patch) | |
| tree | fcc399d30549b437bd68aa477c3004bc55f1cb29 /src/libsyntax/parse | |
| parent | cda00831e39806a4d0ff1e1b2fcaf7fda9d2cfd2 (diff) | |
| parent | 17934e5c29509fe72dbf6228033ab632919dba95 (diff) | |
| download | rust-5a61d43526b97d864b68a98008837a09629f2573.tar.gz rust-5a61d43526b97d864b68a98008837a09629f2573.zip | |
Rollup merge of #24739 - nrc:span-item, r=huonw
(And other kinds of items). This brings trait/impl items in line with top-level items in this respect. It means we don't get the attributes when showing error messages for methods, etc. (a good thing, I think). Since attributes have spans it is still easy to create a span for the item + all attributes.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index dc577f603f6..68006a8979a 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1151,8 +1151,8 @@ impl<'a> Parser<'a> { &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 @@ impl<'a> Parser<'a> { } } - 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 @@ impl<'a> Parser<'a> { /// 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 @@ impl<'a> Parser<'a> { /// 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) { |
