@@ -84,7 +84,7 @@ that does _not_ occur in the set of [keywords](#keywords).
84
84
## Comments
85
85
86
86
Comments in Rust code follow the general C++ style of line (` // ` ) and
87
- block-comment (` /* ... */ ` ) forms. Nested block comments are supported.
87
+ block (` /* ... */ ` ) comment forms. Nested block comments are supported.
88
88
89
89
Line comments beginning with exactly _ three_ slashes (` /// ` ), and block
90
90
comments beginning with exactly one repeated asterisk in the block-open
@@ -192,13 +192,13 @@ which must be _escaped_ by a preceding `U+005C` character (`\`).
192
192
193
193
A _ string literal_ is a sequence of any Unicode characters enclosed within two
194
194
` U+0022 ` (double-quote) characters, with the exception of ` U+0022 ` itself,
195
- which must be _ escaped_ by a preceding ` U+005C ` character (` \ ` ), or a _ raw
196
- string literal_ .
195
+ which must be _ escaped_ by a preceding ` U+005C ` character (` \ ` ).
197
196
198
- A multi-line string literal may be defined by terminating each line with a
199
- ` U+005C ` character (` \ ` ) immediately before the newline. This causes the
200
- ` U+005C ` character, the newline, and all whitespace at the beginning of the
201
- next line to be ignored.
197
+ Line-break characters are allowed in string literals. Normally they represent
198
+ themselves (i.e. no translation), but as a special exception, when a ` U+005C `
199
+ character (` \ ` ) occurs immediately before the newline, the ` U+005C ` character,
200
+ the newline, and all whitespace at the beginning of the next line are ignored.
201
+ Thus ` a ` and ` b ` are equal:
202
202
203
203
``` rust
204
204
let a = " foobar" ;
@@ -366,11 +366,19 @@ A _floating-point literal_ has one of two forms:
366
366
optionally followed by another decimal literal, with an optional _ exponent_ .
367
367
* A single _ decimal literal_ followed by an _ exponent_ .
368
368
369
- By default, a floating-point literal has a generic type, and, like integer
370
- literals, the type must be uniquely determined from the context. There are two valid
369
+ Like integer literals, a floating-point literal may be followed by a
370
+ suffix, so long as the pre-suffix part does not end with ` U+002E ` (` . ` ).
371
+ The suffix forcibly sets the type of the literal. There are two valid
371
372
_ floating-point suffixes_ , ` f32 ` and ` f64 ` (the 32-bit and 64-bit floating point
372
373
types), which explicitly determine the type of the literal.
373
374
375
+ The type of an _ unsuffixed_ floating-point literal is determined by type
376
+ inference. If a floating-point type can be _ uniquely_ determined from the
377
+ surrounding program context, the unsuffixed floating-point literal has that type.
378
+ If the program context underconstrains the type, it defaults to double-precision ` f64 ` ;
379
+ if the program context overconstrains the type, it is considered a static type
380
+ error.
381
+
374
382
Examples of floating-point literals of various forms:
375
383
376
384
```
0 commit comments