about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/lexer/mod.rs6
1 files changed, 3 insertions, 3 deletions
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");
                                 }
                             }
                             _ => ()