Change:
The doesn't document what escape sequences are valid if any. For example, documentation doesn't state whether this will match a newline as would be expected: It also doesn't specify what format these strings are supposed to be written in. Much of the documentation including many escape sequences are documented in the but it is difficult (slow) to parse as it is. I think it would be good to have it in or at least to make the reference more clear. More escape documentation is in (though it's not exactly related). For what it's worth, doesn't seem to document it either (at least, I couldn't find it). Below is my first shot at what it could look like. followed by any number (including zero) of 's followed by and closed in the reverse: A single ASCII character: A sequence of ASCII characters: Note: I'm not really familiar with all the string formats. I'm just to collect them together so they're more obvious. Does it make sense to collect them onto the  page? If so, I can probably submit a PR making something like this but I'm not sure where it should go.
Python , but in the language reference rather than the standard library documentation. Perhaps Rust’s escape sequences should be documented in the reference, where most other language-documenting features go.
Horizontal Tab, AKA t, ASCII/Unicode 9. See .
Oh, I completely misread this as 6 escapes (but it's 3 with their definitions). The .
I'm quite surprised to find that Rust doesn't have (i.e: 'backspace') built in to the language. Is there a particular reason for this?
asking on is a better place than on a three and a half year old issue.

Discussion:
grammar, but a Rust parser will reject everything but the 12 special cases mentioned in [Number literals](#number-literals) below. <ins> #### Examples ##### Characters and strings |   | Example | Number of `#` pairs allowed | Available characters | Escapes | Equivalent to | |---|---------|-----------------------------|----------------------|---------|---------------| | [Character](#character-literals) | `'H'` | `N/A` | All unicode | `'` & [Byte escapes](#byte-escapes) & [Unicode escapes](#unicode-escapes) | `N/A` | | [String](#string-literals) | `"hello"` | `N/A` | All unicode | `"` & [Byte escapes](#byte-escapes) & [Unicode escapes](#unicode-escapes) | `N/A` | | [Raw](#raw-string-literals) | `r##"hello"##`  | `0...` | All unicode | `N/A` | `N/A` | | [Byte](#byte-literals) | `b'H'` | `N/A` | All ASCII | `'` & [Byte escapes](#byte-escapes) | `u8` | | [Byte string](#byte-string-literals) | `b"hello"` | `N/A`  | All ASCII | `"` & [Byte escapes](#byte-escapes) | `&'static [u8]` | | [Raw byte string](#raw-byte-string-literals) | `br##"hello"##` | `0...` | All ASCII | `N/A` | `&'static [u8]` (unsure...not stated) | ##### Byte escapes |   | Name | |---|------| | `x7F` | 8-bit character code (exactly 2 digits) | | `n` | Newline | | `r` | Carriage return | | `t` | Tab | | `` | Backslash | ##### Unicode escapes |   | Name | |---|------| | `u7FFF` | 16-bit character code (exactly 4 digits) | | `U7EEEFFFF` | 32-bit character code (exactly 8 digits) | ##### Numbers | [Number literals](#number-literals)`*` | Example | Exponentiation | Suffixes | |----------------------------------------|---------|----------------|----------| | Decimal integer | `98_222i` | `N/A` | Integer suffixes | | Hex integer | `0xffi` | `N/A` | Integer suffixes | | Octal integer | `0o77i` | `N/A` | Integer suffixes | | Binary integer | `0b1111_0000i` | `N/A` | Integer suffixes | | Floating-point | `123.0E+77f64` | `Optional` | Floating-point suffixes | `*` All number literals allow `_` as a visual separator: `1_234.0E+18f64` ##### Suffixes | Integer | Floating-point | |---------|----------------| | `i` (`int`), `u` (`uint`), `u8`, `i8`, `u16`, `i16`, `u32`, `i32`, `u64`, `i64` | `f32`, `f64` | </ins> #### Character and string literals ```{.ebnf .gram}

| '5' | '6' | '7' | '8' | '9' ; ``` <ins> ##### Character literals </ins> A _character literal_ is a single Unicode character enclosed within two `U+0027` (single-quote) characters, with the exception of `U+0027` itself, which must be _escaped_ by a preceding U+005C character (``). <ins> ##### String literals </ins> 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_. <ins> ##### Character escapes </ins> Some additional _escapes_ are available in either character or non-raw string literals. An escape starts with a `U+005C` (``) and continues with one of the following forms:

* The _backslash escape_ is the character `U+005C` (``) which must be escaped in order to denote *itself*. <ins> ##### Raw string literals </ins> Raw string literals do not process any escapes. They start with the character `U+0072` (`r`), followed by zero or more of the character `U+0023` (`#`) and a `U+0022` (double-quote) character. The _raw string body_ is not defined in the

``` <ins> ##### Byte literals </ins> A _byte literal_ is a single ASCII character (in the `U+0000` to `U+007F` range) enclosed within two `U+0027` (single-quote) characters, with the exception of `U+0027` itself, which must be _escaped_ by a preceding U+005C character (``), or a single _escape_. It is equivalent to a `u8` unsigned 8-bit integer _number literal_. <ins> ##### Byte string literals </ins> A _byte string literal_ is a sequence of ASCII characters and _escapes_ 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

* The _backslash escape_ is the character `U+005C` (``) which must be escaped in order to denote its ASCII encoding `0x5C`. <ins> ##### Raw byte string literals </ins> Raw byte string literals do not process any escapes. They start with the character `U+0062` (`b`), followed by `U+0072` (`r`), followed by zero or more of the character `U+0023` (`#`), and a `U+0022` (double-quote) character. The

//! # Representation //! //! Rust's string type, `str`, is a sequence of Unicode scalar values encoded as a <del> //! stream of UTF-8 bytes. All strings are guaranteed to be validly encoded UTF-8 //! sequences. Additionally, strings are not null-terminated and can thus contain //! null bytes. </del> <ins> //! stream of UTF-8 bytes. All [strings](../../reference.html#literals) are //! guaranteed to be validly encoded UTF-8 sequences. Additionally, strings are //! not null-terminated and can thus contain null bytes. </ins> //! //! The actual representation of strings have direct mappings to slices: `&str` //! is the same as `&[u8]`.