From aef0581513f3fd01068cb423d9c62cb48b3f077a Mon Sep 17 00:00:00 2001 From: Lee Jeffery Date: Wed, 13 May 2015 22:05:01 +0100 Subject: Fix byte offset and error message inconsistencies --- src/libsyntax/parse/lexer/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/libsyntax/parse') diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index 1a772783c9d..81b283a622e 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -406,7 +406,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 = self.pos - BytePos(3); + let start_bpos = self.last_pos - BytePos(2); while !self.is_eof() { match self.curr.unwrap() { @@ -415,9 +415,9 @@ impl<'a> StringReader<'a> { if self.nextch_is('\n') { // CRLF break - } else { + } else if doc_comment { self.err_span_(self.last_pos, self.pos, - "bare CR not allowed in comment"); + "bare CR not allowed in doc-comment"); } } _ => () -- cgit 1.4.1-3-g733a5