about summary refs log tree commit diff
path: root/src/test
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/test
parent1940c31c92d2a0e4def356a17d6445388779d781 (diff)
parent0e8e45c74068b72301f9045f0efc38ba8b51e0a4 (diff)
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/test')
-rw-r--r--src/test/parse-fail/lex-bare-cr-string-literal-doc-comment.rs6
-rw-r--r--src/test/run-pass/lex-bare-cr-nondoc-comment.rs18
2 files changed, 24 insertions, 0 deletions
diff --git a/src/test/parse-fail/lex-bare-cr-string-literal-doc-comment.rs b/src/test/parse-fail/lex-bare-cr-string-literal-doc-comment.rs
index f8943057543..ac085d47511 100644
--- a/src/test/parse-fail/lex-bare-cr-string-literal-doc-comment.rs
+++ b/src/test/parse-fail/lex-bare-cr-string-literal-doc-comment.rs
@@ -21,6 +21,12 @@ pub fn bar() {}
 //~^^ ERROR: bare CR not allowed in block doc-comment
 
 fn main() {
+    //! doc comment with bare CR: '
'
+    //~^ ERROR: bare CR not allowed in doc-comment
+
+    /*! block doc comment with bare CR: '
' */
+    //~^ ERROR: bare CR not allowed in block doc-comment
+
     // the following string literal has a bare CR in it
     let _s = "foo
bar"; //~ ERROR: bare CR not allowed in string
 
diff --git a/src/test/run-pass/lex-bare-cr-nondoc-comment.rs b/src/test/run-pass/lex-bare-cr-nondoc-comment.rs
new file mode 100644
index 00000000000..ba949ca8881
--- /dev/null
+++ b/src/test/run-pass/lex-bare-cr-nondoc-comment.rs
@@ -0,0 +1,18 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-tidy-cr
+
+// nondoc comment with bare CR: '
'
+//// nondoc comment with bare CR: '
'
+/* block nondoc comment with bare CR: '
' */
+
+fn main() {
+}