diff options
| author | Phil Dawes <phil@phildawes.net> | 2014-07-04 21:46:39 +0100 |
|---|---|---|
| committer | Phil Dawes <phil@phildawes.net> | 2014-07-04 21:54:42 +0100 |
| commit | 9deeaefdbb8ffeec69439e271a97f4cce617da20 (patch) | |
| tree | a2e108c2bfa54d8ff19777893717422b35ceee9c /src/libsyntax | |
| parent | 25e8b6ed9c9cf60448eb95a0e8a42330ed44f479 (diff) | |
| download | rust-9deeaefdbb8ffeec69439e271a97f4cce617da20.tar.gz rust-9deeaefdbb8ffeec69439e271a97f4cce617da20.zip | |
Parser: fix PatIdent span bug
Fix small bug introduced in e38cb972dcf: PatIdent span was incorrect because self.last_span was being used before the ident token was parsed.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index f3789e25bc8..9ce13957396 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3119,8 +3119,9 @@ impl<'a> Parser<'a> { 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 { |
