]> git.lizzy.rs Git - rust.git/blob - src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.rs
Rollup merge of #56217 - frewsxcv:frewsxcv-float-parse, r=QuietMisdreavus
[rust.git] / src / test / ui / parser / lex-bare-cr-string-literal-doc-comment.rs
1 // compile-flags: -Z continue-parse-after-error
2
3 // ignore-tidy-cr
4
5 /// doc comment with bare CR: '\r'
6 pub fn foo() {}
7 //~^^ ERROR: bare CR not allowed in doc-comment
8
9 /** block doc comment with bare CR: '\r' */
10 pub fn bar() {}
11 //~^^ ERROR: bare CR not allowed in block doc-comment
12
13 fn main() {
14     //! doc comment with bare CR: '\r'
15     //~^ ERROR: bare CR not allowed in doc-comment
16
17     /*! block doc comment with bare CR: '\r' */
18     //~^ ERROR: bare CR not allowed in block doc-comment
19
20     // the following string literal has a bare CR in it
21     let _s = "foo\rbar"; //~ ERROR: bare CR not allowed in string
22
23     // the following string literal has a bare CR in it
24     let _s = r"bar\rfoo"; //~ ERROR: bare CR not allowed in raw string
25
26     // the following string literal has a bare CR in it
27     let _s = "foo\\rbar"; //~ ERROR: unknown character escape: \r
28 }