@@ -329,10 +329,6 @@ literal_. The grammar for recognizing the two kinds of literals is mixed.
329329> DEC_LITERAL :\
330330>   ;  ; DEC_DIGIT (DEC_DIGIT|` _ ` )<sup >\* </sup >
331331>
332- > TUPLE_INDEX :\
333- >   ;  ;   ;  ; ` 0 `
334- >   ;  ; | NON_ZERO_DEC_DIGIT DEC_DIGIT<sup >\* </sup >
335- >
336332> BIN_LITERAL :\
337333>   ;  ; ` 0b ` (BIN_DIGIT|` _ ` )<sup >\* </sup > BIN_DIGIT (BIN_DIGIT|` _ ` )<sup >\* </sup >
338334>
@@ -348,8 +344,6 @@ literal_. The grammar for recognizing the two kinds of literals is mixed.
348344>
349345> DEC_DIGIT : [ ` 0 ` -` 9 ` ]
350346>
351- > NON_ZERO_DEC_DIGIT : [ ` 1 ` -` 9 ` ]
352- >
353347> HEX_DIGIT : [ ` 0 ` -` 9 ` ` a ` -` f ` ` A ` -` F ` ]
354348>
355349> INTEGER_SUFFIX :\
@@ -360,9 +354,6 @@ An _integer literal_ has one of four forms:
360354
361355* A _ decimal literal_ starts with a * decimal digit* and continues with any
362356 mixture of * decimal digits* and _ underscores_ .
363- * A _ tuple index_ is either ` 0 ` , or starts with a * non-zero decimal digit* and
364- continues with zero or more decimal digits. Tuple indexes are used to refer
365- to the fields of [ tuples] , [ tuple structs] , and [ tuple variants] .
366357* A _ hex literal_ starts with the character sequence ` U+0030 ` ` U+0078 `
367358 (` 0x ` ) and continues as any mixture (with at least one digit) of hex digits
368359 and underscores.
@@ -442,6 +433,33 @@ a single integer literal.
442433
443434[ unary minus operator ] : expressions/operator-expr.md#negation-operators
444435
436+ #### Tuple index
437+
438+ > ** <sup >Lexer</sup >** \
439+ > TUPLE_INDEX: \
440+ >   ;  ; INTEGER_LITERAL
441+
442+ A tuple index is used to refer to the fields of [ tuples] , [ tuple structs] , and
443+ [ tuple variants] .
444+
445+ Tuple indices are compared with the literal token directly. Tuple indices
446+ start with ` 0 ` and each successive index increments the value by ` 1 ` as a
447+ decimal value. Thus, only decimal values will match, and the value must not
448+ have any extra ` 0 ` prefix characters.
449+
450+ ``` rust,compile_fail
451+ let example = ("dog", "cat", "horse");
452+ let dog = example.0;
453+ let cat = example.1;
454+ // The following examples are invalid.
455+ let cat = example.01; // ERROR no field named `01`
456+ let horse = example.0b10; // ERROR no field named `0b10`
457+ ```
458+
459+ > ** Note** : The tuple index may include an ` INTEGER_SUFFIX ` , but this is not
460+ > intended to be valid, and may be removed in a future version. See
461+ > < https://github.com/rust-lang/rust/issues/60210 > for more information.
462+
445463#### Floating-point literals
446464
447465> ** <sup >Lexer</sup >** \
0 commit comments