about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorMichael Woerister <michaelwoerister@posteo>2018-06-28 10:45:57 +0200
committerMichael Woerister <michaelwoerister@posteo>2018-06-28 10:46:04 +0200
commita1f8a6ce80a340d51074071c0d9e30eb14f65d25 (patch)
treec029a685cd4b14a2deb5f8b215d09467d2950a6c /src/libsyntax/parse
parentba30c1dac9d0af45836403b2da89561a627b9a6e (diff)
downloadrust-a1f8a6ce80a340d51074071c0d9e30eb14f65d25.tar.gz
rust-a1f8a6ce80a340d51074071c0d9e30eb14f65d25.zip
Fix FileMap::line_begin_pos().
The method relied on the FileMap still being under construction in
order for it to do what the name promises. It's now independent of
the current state.
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/lexer/comments.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libsyntax/parse/lexer/comments.rs b/src/libsyntax/parse/lexer/comments.rs
index 7da0d816d0f..3995a9b8689 100644
--- a/src/libsyntax/parse/lexer/comments.rs
+++ b/src/libsyntax/parse/lexer/comments.rs
@@ -240,9 +240,11 @@ fn read_block_comment(rdr: &mut StringReader,
     let mut lines: Vec<String> = Vec::new();
 
     // Count the number of chars since the start of the line by rescanning.
-    let mut src_index = rdr.src_index(rdr.filemap.line_begin_pos());
+    let mut src_index = rdr.src_index(rdr.filemap.line_begin_pos(rdr.pos));
     let end_src_index = rdr.src_index(rdr.pos);
-    assert!(src_index <= end_src_index);
+    assert!(src_index <= end_src_index,
+        "src_index={}, end_src_index={}, line_begin_pos={}",
+        src_index, end_src_index, rdr.filemap.line_begin_pos(rdr.pos).to_u32());
     let mut n = 0;
     while src_index < end_src_index {
         let c = char_at(&rdr.src, src_index);