]> git.lizzy.rs Git - rust.git/commitdiff
Parser: fix PatIdent span bug
authorPhil Dawes <phil@phildawes.net>
Fri, 4 Jul 2014 20:46:39 +0000 (21:46 +0100)
committerPhil Dawes <phil@phildawes.net>
Fri, 4 Jul 2014 20:54:42 +0000 (21:54 +0100)
Fix small bug introduced in e38cb972dcf: PatIdent span was incorrect
because self.last_span was being used before the ident token was
parsed.

src/libsyntax/parse/parser.rs

index f3789e25bc8a7e5e39bc1e1ded000561e43c4578..9ce139573966fd27090bb224c3d17309f204f57d 100644 (file)
@@ -3119,8 +3119,9 @@ fn parse_pat_ident(&mut self,
             self.span_fatal(last_span,
                             "expected identifier, found path");
         }
-        // why a path here, and not just an identifier?
-        let name = codemap::Spanned{span: self.last_span, node: self.parse_ident()};
+        let ident = self.parse_ident();
+        let last_span = self.last_span;
+        let name = codemap::Spanned{span: last_span, node: ident};
         let sub = if self.eat(&token::AT) {
             Some(self.parse_pat())
         } else {