Skip to content

Chapter 3.2: Confusing introduction of numeric type suffixes #2854

Open
@jruderman

Description

@jruderman
  • I have checked the latest main branch to see if this has already been fixed
  • I have searched existing issues and pull requests for duplicates

URL to the section(s) of the book with this problem:

https://doc.rust-lang.org/book/ch03-02-data-types.html (but only in a newer version than on the web site)

Description of the problem:

Note that number literals that can be multiple numeric types allow a type suffix, such as 57u8, to designate the type.

  • This raises the question of which number literals cannot be multiple numeric types. My first thought was 0xffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff, which can only be u128, but it does accept the suffix.
  • Seeing the history of this text (Misleading "byte literal" mention in 3.2. Data Types #1979), I see that it's meant to exclude byte literals (as they could be considered a kind of number literal) without naming them (because byte literals haven't been introduced yet).

Suggested fix:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions