Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ literal_. The grammar for recognizing the two kinds of literals is mixed.
> INTEGER_SUFFIX :\
>       `u8` | `u16` | `u32` | `u64` | `u128` | `usize`\
>    | `i8` | `i16` | `i32` | `i64` | `i128` | `isize`
>    | `f32` | `f64`

An _integer literal_ has one of four forms:

Expand All @@ -368,7 +369,10 @@ Like any literal, an integer literal may be followed (immediately,
without any spaces) by an _integer suffix_, which forcibly sets the
type of the literal. The integer suffix must be the name of one of the
integral types: `u8`, `i8`, `u16`, `i16`, `u32`, `i32`, `u64`, `i64`,
`u128`, `i128`, `usize`, or `isize`.
`u128`, `i128`, `f32`,`f64`, `usize`, or `isize`.

Note the suffix of `f32` and `f64` ensures that the literal has a floating point type.
Even when it would otherwise be lexed as an integer.

The type of an _unsuffixed_ integer literal is determined by type inference:

Expand Down