about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-10-22 07:07:09 +0000
committerbors <bors@rust-lang.org>2014-10-22 07:07:09 +0000
commit7088c45ef4078e0be54d4353b2c11146e25b2906 (patch)
tree48268c53733ca2bfa58336f9a5cd2a4dfd0b5f47 /src/libsyntax/parse/parser.rs
parentc29a7520e7fb4a5b4d4eccfc594e05793ef6688d (diff)
parent9c7865fa6fad826d7bf542a2cb36f63d0ae2410b (diff)
downloadrust-7088c45ef4078e0be54d4353b2c11146e25b2906.tar.gz
rust-7088c45ef4078e0be54d4353b2c11146e25b2906.zip
auto merge of #18141 : phildawes/rust/master, r=brson
Hello! I noticed spans are wrong for the PatIdents of self args. (I use spans a lot in racer)
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 abab816bfeb..ed806ad803a 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -4165,10 +4165,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
@@ -4240,7 +4246,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