about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2017-05-08 22:34:49 -0400
committerGitHub <noreply@github.com>2017-05-08 22:34:49 -0400
commit933df894a62cae7686c5579e3fd9c4b5c48e1d50 (patch)
tree2363aeef68bbe29412e011cdf1a46cc39e4185ed /src/libsyntax/parse
parent1940c31c92d2a0e4def356a17d6445388779d781 (diff)
parent0e8e45c74068b72301f9045f0efc38ba8b51e0a4 (diff)
downloadrust-933df894a62cae7686c5579e3fd9c4b5c48e1d50.tar.gz
rust-933df894a62cae7686c5579e3fd9c4b5c48e1d50.zip
Rollup merge of #41827 - qnighy:allow-bare-cr-in-nondoc-comment, r=estebank
Allow bare CR in ////-style comment.

Fixes #40624 in a way that bare CR is allowed in all non-doc comments.
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/lexer/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs
index 7d2a1b3c4a4..ded1f0b599a 100644
--- a/src/libsyntax/parse/lexer/mod.rs
+++ b/src/libsyntax/parse/lexer/mod.rs
@@ -504,7 +504,7 @@ impl<'a> StringReader<'a> {
                     self.bump();
 
                     // line comments starting with "///" or "//!" are doc-comments
-                    let doc_comment = self.ch_is('/') || self.ch_is('!');
+                    let doc_comment = (self.ch_is('/') && !self.nextch_is('/')) || self.ch_is('!');
                     let start_bpos = self.pos - BytePos(2);
 
                     while !self.is_eof() {