@@ -20,13 +20,15 @@ evaluated (primarily) at compile time.
20
20
#### Characters and strings
21
21
22
22
| | Example | ` # ` sets | Characters | Escapes |
23
- | ----------------------------------------------| -----------------| ------------| -------------| ---------------------|
24
- | [ Character] ( #character-literals ) | ` 'H' ` | ` N/A ` | All Unicode | [ Quote] ( #quote-escapes ) & [ ASCII] ( #ascii-escapes ) & [ Unicode] ( #unicode-escapes ) |
25
- | [ String] ( #string-literals ) | ` "hello" ` | ` N/A ` | All Unicode | [ Quote] ( #quote-escapes ) & [ ASCII] ( #ascii-escapes ) & [ Unicode] ( #unicode-escapes ) |
26
- | [ Raw] ( #raw-string-literals ) | ` r#"hello"# ` | ` 0... ` | All Unicode | ` N/A ` |
27
- | [ Byte] ( #byte-literals ) | ` b'H' ` | ` N/A ` | All ASCII | [ Quote] ( #quote-escapes ) & [ Byte] ( #byte-escapes ) |
28
- | [ Byte string] ( #byte-string-literals ) | ` b"hello" ` | ` N/A ` | All ASCII | [ Quote] ( #quote-escapes ) & [ Byte] ( #byte-escapes ) |
29
- | [ Raw byte string] ( #raw-byte-string-literals ) | ` br#"hello"# ` | ` 0... ` | All ASCII | ` N/A ` |
23
+ | ----------------------------------------------| -----------------| -------------| -------------| ---------------------|
24
+ | [ Character] ( #character-literals ) | ` 'H' ` | 0 | All Unicode | [ Quote] ( #quote-escapes ) & [ ASCII] ( #ascii-escapes ) & [ Unicode] ( #unicode-escapes ) |
25
+ | [ String] ( #string-literals ) | ` "hello" ` | 0 | All Unicode | [ Quote] ( #quote-escapes ) & [ ASCII] ( #ascii-escapes ) & [ Unicode] ( #unicode-escapes ) |
26
+ | [ Raw] ( #raw-string-literals ) | ` r#"hello"# ` | 0 or more\* | All Unicode | ` N/A ` |
27
+ | [ Byte] ( #byte-literals ) | ` b'H' ` | 0 | All ASCII | [ Quote] ( #quote-escapes ) & [ Byte] ( #byte-escapes ) |
28
+ | [ Byte string] ( #byte-string-literals ) | ` b"hello" ` | 0 | All ASCII | [ Quote] ( #quote-escapes ) & [ Byte] ( #byte-escapes ) |
29
+ | [ Raw byte string] ( #raw-byte-string-literals ) | ` br#"hello"# ` | 0 or more\* | All ASCII | ` N/A ` |
30
+
31
+ \* The number of ` # ` s on each side of the same literal must be equivalent
30
32
31
33
#### ASCII escapes
32
34
@@ -79,7 +81,7 @@ evaluated (primarily) at compile time.
79
81
80
82
| Integer | Floating-point |
81
83
| ---------| ----------------|
82
- | ` u8 ` , ` i8 ` , ` u16 ` , ` i16 ` , ` u32 ` , ` i32 ` , ` u64 ` , ` i64 ` , ` isize ` , ` usize ` | ` f32 ` , ` f64 ` |
84
+ | ` u8 ` , ` i8 ` , ` u16 ` , ` i16 ` , ` u32 ` , ` i32 ` , ` u64 ` , ` i64 ` , ` u128 ` , ` i128 ` , ` isize ` , ` usize ` | ` f32 ` , ` f64 ` |
83
85
84
86
### Character and string literals
85
87
@@ -142,7 +144,7 @@ Some additional _escapes_ are available in either character or non-raw string
142
144
literals. An escape starts with a ` U+005C ` (` \ ` ) and continues with one of the
143
145
following forms:
144
146
145
- * An _ 8 -bit code point escape_ starts with ` U+0078 ` (` x ` ) and is
147
+ * A _ 7 -bit code point escape_ starts with ` U+0078 ` (` x ` ) and is
146
148
followed by exactly two _ hex digits_ with value up to ` 0x7F ` . It denotes the
147
149
ASCII character with value equal to the provided hex value. Higher values are
148
150
not permitted because it is ambiguous whether they mean Unicode code points or
@@ -202,7 +204,7 @@ r##"foo #"# bar"##; // foo #"# bar
202
204
>   ;  ; ` b' ` ( ASCII_FOR_CHAR | BYTE_ESCAPE ) ` ' `
203
205
>
204
206
> ASCII_FOR_CHAR :
205
- >   ;  ; _ any ASCII (i.e. 0x00 to 0x7F), except_ ` ' ` , ` / ` , \\ n, \\ r or \\ t
207
+ >   ;  ; _ any ASCII (i.e. 0x00 to 0x7F), except_ ` ' ` , ` \ ` , \\ n, \\ r or \\ t
206
208
>
207
209
> BYTE_ESCAPE :
208
210
>   ;  ;   ;  ; ` \x ` HEX_DIGIT HEX_DIGIT
@@ -222,7 +224,7 @@ _number literal_.
222
224
>   ;  ; ` b" ` ( ASCII_FOR_STRING | BYTE_ESCAPE | STRING_CONTINUE )<sup >\* </sup > ` " `
223
225
>
224
226
> ASCII_FOR_STRING :
225
- >   ;  ; _ any ASCII (i.e 0x00 to 0x7F), except_ ` " ` , ` / ` _ and IsolatedCR_
227
+ >   ;  ; _ any ASCII (i.e 0x00 to 0x7F), except_ ` " ` , ` \ ` _ and IsolatedCR_
226
228
227
229
A non-raw _ byte string literal_ is a sequence of ASCII characters and _ escapes_ ,
228
230
preceded by the characters ` U+0062 ` (` b ` ) and ` U+0022 ` (double-quote), and
@@ -324,10 +326,8 @@ literal_. The grammar for recognizing the two kinds of literals is mixed.
324
326
> HEX_DIGIT : [ ` 0 ` -` 9 ` ` a ` -` f ` ` A ` -` F ` ]
325
327
>
326
328
> INTEGER_SUFFIX :
327
- >   ;  ;   ;  ; ` u8 ` | ` u16 ` | ` u32 ` | ` u64 ` | ` usize `
328
- >   ;  ; | ` i8 ` | ` i16 ` | ` i32 ` | ` i64 ` | ` isize `
329
-
330
- <!-- FIXME: u128 and i128 -->
329
+ >   ;  ;   ;  ; ` u8 ` | ` u16 ` | ` u32 ` | ` u64 ` | ` u128 ` | ` usize `
330
+ >   ;  ; | ` i8 ` | ` i16 ` | ` i32 ` | ` i64 ` | ` i128 ` | ` isize `
331
331
332
332
An _ integer literal_ has one of four forms:
333
333
@@ -350,7 +350,7 @@ Like any literal, an integer literal may be followed (immediately,
350
350
without any spaces) by an _ integer suffix_ , which forcibly sets the
351
351
type of the literal. The integer suffix must be the name of one of the
352
352
integral types: ` u8 ` , ` i8 ` , ` u16 ` , ` i16 ` , ` u32 ` , ` i32 ` , ` u64 ` , ` i64 ` ,
353
- ` isize ` , or ` usize ` .
353
+ ` u128 ` , ` i128 ` , ` isize ` , or ` usize ` .
354
354
355
355
The type of an _ unsuffixed_ integer literal is determined by type inference:
356
356
0 commit comments