diff options
| author | Steve Klabnik <steve@steveklabnik.com> | 2015-04-27 10:26:19 -0400 |
|---|---|---|
| committer | Steve Klabnik <steve@steveklabnik.com> | 2015-04-27 10:26:19 -0400 |
| commit | 188f3eb8f54d6224cec6a14c1c70372e02550a15 (patch) | |
| tree | 47157ca576061912a364cd8e77603269ef7a42ca | |
| parent | be569bcd3591204825c02874d9bdbc9d6bc5fa1d (diff) | |
| parent | cf650a217495940bdf3f8a843f5dd959b6e37b5e (diff) | |
Rollup merge of #24863 - dhardy:patch-1, r=steveklabnik
Remove the name "multi-line string literal" since the rule appears to affect each line-break individually rather than the whole string literal. Re-word, and remove the stray reference to raw strings.
| -rw-r--r-- | src/doc/reference.md | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/doc/reference.md b/src/doc/reference.md index 7c9cca90edd..848c0df10ee 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -192,13 +192,13 @@ which must be _escaped_ by a preceding `U+005C` character (`\`). A _string literal_ is a sequence of any Unicode characters enclosed within two `U+0022` (double-quote) characters, with the exception of `U+0022` itself, -which must be _escaped_ by a preceding `U+005C` character (`\`), or a _raw -string literal_. +which must be _escaped_ by a preceding `U+005C` character (`\`). -A multi-line string literal may be defined by terminating each line with a -`U+005C` character (`\`) immediately before the newline. This causes the -`U+005C` character, the newline, and all whitespace at the beginning of the -next line to be ignored. +Line-break characters are allowed in string literals. Normally they represent +themselves (i.e. no translation), but as a special exception, when a `U+005C` +character (`\`) occurs immediately before the newline, the `U+005C` character, +the newline, and all whitespace at the beginning of the next line are ignored. +Thus `a` and `b` are equal: ```rust let a = "foobar"; @@ -366,11 +366,19 @@ A _floating-point literal_ has one of two forms: optionally followed by another decimal literal, with an optional _exponent_. * A single _decimal literal_ followed by an _exponent_. -By default, a floating-point literal has a generic type, and, like integer -literals, the type must be uniquely determined from the context. There are two valid +Like integer literals, a floating-point literal may be followed by a +suffix, so long as the pre-suffix part does not end with `U+002E` (`.`). +The suffix forcibly sets the type of the literal. There are two valid _floating-point suffixes_, `f32` and `f64` (the 32-bit and 64-bit floating point types), which explicitly determine the type of the literal. +The type of an _unsuffixed_ floating-point literal is determined by type +inference. If a floating-point type can be _uniquely_ determined from the +surrounding program context, the unsuffixed floating-point literal has that type. +If the program context underconstrains the type, it defaults to double-precision `f64`; +if the program context overconstrains the type, it is considered a static type +error. + Examples of floating-point literals of various forms: ``` |
