about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorLee Jeffery <leejeffery@gmail.com>2015-05-14 18:19:51 +0100
committerLee Jeffery <leejeffery@gmail.com>2015-05-14 18:19:51 +0100
commit93af5f9b446adfeb95abdd8df76cf961451f9d91 (patch)
tree755a8a45e7a0fdf34a44f2dbec41f63d8dd213c8 /src/libsyntax/parse
parent4f82c3151b063a4226f33df047d4e748ef5e3f13 (diff)
downloadrust-93af5f9b446adfeb95abdd8df76cf961451f9d91.tar.gz
rust-93af5f9b446adfeb95abdd8df76cf961451f9d91.zip
Make BytePos calculation same as original
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/lexer/mod.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs
index 184f503bbc2..1ca4451d28d 100644
--- a/src/libsyntax/parse/lexer/mod.rs
+++ b/src/libsyntax/parse/lexer/mod.rs
@@ -406,7 +406,6 @@ impl<'a> StringReader<'a> {
 
                     // line comments starting with "///" or "//!" are doc-comments
                     let doc_comment = self.curr_is('/') || self.curr_is('!');
-                    let start_bpos = self.last_pos - BytePos(2);
 
                     while !self.is_eof() {
                         match self.curr.unwrap() {
@@ -426,6 +425,7 @@ impl<'a> StringReader<'a> {
                     }
 
                     return if doc_comment {
+                        let start_bpos = self.pos - BytePos(3);
                         self.with_str_from(start_bpos, |string| {
                             // comments with only more "/"s are not doc comments
                             let tok = if is_doc_comment(string) {
@@ -440,6 +440,7 @@ impl<'a> StringReader<'a> {
                             })
                         })
                     } else {
+                        let start_bpos = self.last_pos - BytePos(2);
                         Some(TokenAndSpan {
                             tok: token::Comment,
                             sp: codemap::mk_sp(start_bpos, self.last_pos)