about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2017-10-08 13:39:02 +0800
committerGitHub <noreply@github.com>2017-10-08 13:39:02 +0800
commit48cb6af50b1c6d391cd6aa6c69df31ce4ab092f6 (patch)
treeb9870005b70774b284ca6f712e3e35fc27a5cfeb /src/libsyntax
parentae54d5ecae12de1a4e2f4e7e02036f24e5363d32 (diff)
parent14c6c119042d2cfbaea0e17e47d2c160261e73ab (diff)
downloadrust-48cb6af50b1c6d391cd6aa6c69df31ce4ab092f6.tar.gz
rust-48cb6af50b1c6d391cd6aa6c69df31ce4ab092f6.zip
Rollup merge of #45060 - topecongiro:semi-in-local-span, r=petrochenkov
Add a semicolon to span for ast::Local
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/parse/parser.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 65dabe98a06..978e06c75dd 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -3671,12 +3671,17 @@ impl<'a> Parser<'a> {
             None
         };
         let init = self.parse_initializer()?;
+        let hi = if self.token == token::Semi {
+            self.span
+        } else {
+            self.prev_span
+        };
         Ok(P(ast::Local {
             ty,
             pat,
             init,
             id: ast::DUMMY_NODE_ID,
-            span: lo.to(self.prev_span),
+            span: lo.to(hi),
             attrs,
         }))
     }