diff options
| author | Michael Woerister <michaelwoerister@posteo> | 2018-06-28 10:45:57 +0200 |
|---|---|---|
| committer | Michael Woerister <michaelwoerister@posteo> | 2018-06-28 10:46:04 +0200 |
| commit | a1f8a6ce80a340d51074071c0d9e30eb14f65d25 (patch) | |
| tree | c029a685cd4b14a2deb5f8b215d09467d2950a6c /src/libsyntax/parse | |
| parent | ba30c1dac9d0af45836403b2da89561a627b9a6e (diff) | |
| download | rust-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.rs | 6 |
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); |
