about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorPhil Dawes <pdawes@drw.com>2014-10-15 18:04:29 +0100
committerPhil Dawes <pdawes@drw.com>2014-10-18 16:05:26 +0100
commit9c7865fa6fad826d7bf542a2cb36f63d0ae2410b (patch)
treeb22af7f65609fafde28f4d881e722e88dd32ed42 /src/libsyntax/parse/parser.rs
parentc7c342d10c34e1ca1d809da42d7794db2d0860ad (diff)
downloadrust-9c7865fa6fad826d7bf542a2cb36f63d0ae2410b.tar.gz
rust-9c7865fa6fad826d7bf542a2cb36f63d0ae2410b.zip
Parser: Fix spans of explicit self arg idents
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
-rw-r--r--src/libsyntax/parse/parser.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 17f52bc21c5..635311bb885 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -4164,10 +4164,16 @@ impl<'a> Parser<'a> {
         // A bit of complexity and lookahead is needed here in order to be
         // backwards compatible.
         let lo = self.span.lo;
+        let mut self_ident_lo = self.span.lo;
+        let mut self_ident_hi = self.span.hi;
+
         let mut mutbl_self = MutImmutable;
         let explicit_self = match self.token {
             token::BINOP(token::AND) => {
-                maybe_parse_borrowed_explicit_self(self)
+                let eself = maybe_parse_borrowed_explicit_self(self);
+                self_ident_lo = self.last_span.lo;
+                self_ident_hi = self.last_span.hi;
+                eself
             }
             token::TILDE => {
                 // We need to make sure it isn't a type
@@ -4239,7 +4245,7 @@ impl<'a> Parser<'a> {
             _ => SelfStatic,
         };
 
-        let explicit_self_sp = mk_sp(lo, self.span.hi);
+        let explicit_self_sp = mk_sp(self_ident_lo, self_ident_hi);
 
         // shared fall-through for the three cases below. borrowing prevents simply
         // writing this as a closure