Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions src/libsyntax/parse/lexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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() {
Expand Down