Skip to content

Commit 89311c3

Browse files
committed
Remove tuple index carve out
This is being proposed to be removed in <rust-lang/rust#145463> as we never intended for this to be valid syntax.
1 parent ff45844 commit 89311c3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/tokens.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ r[lex.token.literal.int.tuple-field]
624624

625625
r[lex.token.literal.int.tuple-field.syntax]
626626
```grammar,lexer
627-
TUPLE_INDEX -> INTEGER_LITERAL
627+
TUPLE_INDEX -> DEC_LITERAL | BIN_LITERAL | OCT_LITERAL | HEX_LITERAL
628628
```
629629

630630
r[lex.token.literal.int.tuple-field.intro]
@@ -637,18 +637,18 @@ start with `0` and each successive index increments the value by `1` as a
637637
decimal value. Thus, only decimal values will match, and the value must not
638638
have any extra `0` prefix characters.
639639

640+
Tuple indices may not include any suffixes (such as `usize`).
641+
640642
```rust,compile_fail
641643
let example = ("dog", "cat", "horse");
642644
let dog = example.0;
643645
let cat = example.1;
644646
// The following examples are invalid.
645647
let cat = example.01; // ERROR no field named `01`
646648
let horse = example.0b10; // ERROR no field named `0b10`
649+
let unicorn = example.0usize; // ERROR suffixes on a tuple index are invalid
647650
```
648651

649-
> [!NOTE]
650-
> Tuple indices may include certain suffixes, but this is not intended to be valid, and may be removed in a future version. See <https://github.com/rust-lang/rust/issues/60210> for more information.
651-
652652
r[lex.token.literal.float]
653653
#### Floating-point literals
654654

0 commit comments

Comments
 (0)