book icon indicating copy to clipboard operation
book copied to clipboard

Chapter 3.2: Confusing introduction of numeric type suffixes

Open jruderman opened this issue 4 years ago • 0 comments
trafficstars

  • [x] I have checked the latest main branch to see if this has already been fixed
  • [x] 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 (#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:

  • Remove "that can be multiple numeric types", leaving a simpler sentence
  • Or maybe partially revert #1979

jruderman avatar Sep 09 '21 12:09 jruderman