diff options
| author | bors <bors@rust-lang.org> | 2016-10-04 04:15:20 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-10-04 04:15:20 -0700 |
| commit | 4a9af010ebc728bc4798b1ba30de0322c1f0138a (patch) | |
| tree | 3bff48d27899b511dc1a9c7993de557cb06b887b /src/libsyntax/parse | |
| parent | 5ea241b9fb411b42f0173113d43ef1020ca3df70 (diff) | |
| parent | 177aabdfe3c47412d8d29d9d726640a5134a6b7d (diff) | |
| download | rust-4a9af010ebc728bc4798b1ba30de0322c1f0138a.tar.gz rust-4a9af010ebc728bc4798b1ba30de0322c1f0138a.zip | |
Auto merge of #36953 - Manishearth:rollup, r=Manishearth
Rollup of 12 pull requests - Successful merges: #36798, #36878, #36902, #36903, #36908, #36916, #36917, #36921, #36928, #36938, #36941, #36951 - Failed merges:
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/lexer/mod.rs | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index 6c0e2425d37..0ba2db3310c 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -417,11 +417,9 @@ impl<'a> StringReader<'a> { self.last_pos = self.pos; let current_byte_offset = self.byte_offset(self.pos).to_usize(); if current_byte_offset < self.source_text.len() { - assert!(self.curr.is_some()); let last_char = self.curr.unwrap(); let ch = char_at(&self.source_text, current_byte_offset); - let next = current_byte_offset + ch.len_utf8(); - let byte_offset_diff = next - current_byte_offset; + let byte_offset_diff = ch.len_utf8(); self.pos = self.pos + Pos::from_usize(byte_offset_diff); self.curr = Some(ch); self.col = self.col + CharPos(1); @@ -509,11 +507,7 @@ impl<'a> StringReader<'a> { // line comments starting with "///" or "//!" are doc-comments let doc_comment = self.curr_is('/') || self.curr_is('!'); - let start_bpos = if doc_comment { - self.pos - BytePos(3) - } else { - self.last_pos - BytePos(2) - }; + let start_bpos = self.last_pos - BytePos(2); while !self.is_eof() { match self.curr.unwrap() { |
