Skip to content

Commit 46d4a27

Browse files
committed
Say that out-of-range suffixed integer literals are valid lexer tokens
1 parent 1913a4f commit 46d4a27

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/tokens.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ See [literal expressions] for the effect of these suffixes.
366366
Examples of integer literals of various forms:
367367

368368
```rust
369+
# #![allow(overflowing_literals)]
369370
123;
370371
123i32;
371372
123u32;
@@ -382,6 +383,12 @@ Examples of integer literals of various forms:
382383
0b________1;
383384

384385
0usize;
386+
387+
// These are too big for their type, but are still valid tokens
388+
389+
128_i8;
390+
256_u8;
391+
385392
```
386393

387394
Note that `-1i8`, for example, is analyzed as two tokens: `-` followed by `1i8`.
@@ -399,11 +406,6 @@ Examples of invalid integer literals:
399406
0b0102;
400407
0o0581;
401408
402-
// integers too big for their type (they overflow)
403-
404-
128_i8;
405-
256_u8;
406-
407409
// bin, hex, and octal literals must have at least one digit
408410
409411
0b_;

0 commit comments

Comments
 (0)