File tree 1 file changed +14
-4
lines changed
1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -148,18 +148,28 @@ which must be _escaped_ by a preceding `U+005C` character (`\`).
148
148
Line-breaks are allowed in string literals. A line-break is either a newline
149
149
(` U+000A ` ) or a pair of carriage return and newline (` U+000D ` , ` U+000A ` ). Both
150
150
byte sequences are normally translated to ` U+000A ` , but as a special exception,
151
- when an unescaped ` U+005C ` character (` \ ` ) occurs immediately before the
152
- line-break, then the ` U+005C ` character, the line-break, and all whitespace at the
153
- beginning of the next line are ignored. Thus ` a ` and ` b ` are equal:
151
+ when an unescaped ` U+005C ` character (` \ ` ) occurs immediately before a line
152
+ break, then the line break character(s), and all immediately following
153
+ ` ` (` U+0020 ` ), ` \t ` (` U+0009 ` ), ` \n ` (` U+000A ` ) and ` \r ` (` U+0000D ` ) characters
154
+ are ignored. Thus ` a ` , ` b ` and ` c ` are equal:
154
155
155
156
``` rust
156
157
let a = " foobar" ;
157
158
let b = " foo\
158
159
bar" ;
160
+ let c = " foo\
159
161
160
- assert_eq! (a ,b );
162
+ bar" ;
163
+
164
+ assert_eq! (a , b );
165
+ assert_eq! (b , c );
161
166
```
162
167
168
+ > Note: Rust skipping additional newlines (like in example ` c ` ) is potentially confusing and
169
+ > unexpected. This behavior may be adjusted in the future. Until a decision is made, it is
170
+ > recommended to avoid relying on this, i.e. skipping multiple newlines with line continuations.
171
+ > See [ this issue] ( https://github.com/rust-lang/reference/pull/1042 ) for more information.
172
+
163
173
#### Character escapes
164
174
165
175
Some additional _ escapes_ are available in either character or non-raw string
You can’t perform that action at this time.
0 commit comments