Errata
The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".
The following errata were submitted by our customers and approved as valid errors by the author or editor.
Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update
Version | Location | Description | Submitted By | Date submitted | Date corrected |
---|---|---|---|---|---|
ch4 Ownership In Rust example after Python and C++ examples, explaining `let t = s;` |
This portion should be made clearer, the text reads "So after initializing t, the program’s memory looks like this:" However, the program's memory will never 'look like' anything--as noted in a later paragraph, the program fails to compile. This should be addressed with some comment earlier. Perhaps, after showing the 'equivalent' Rust code, saying something like, "Now, for reasons we will explain for a moment, this code will fail to compile if you're typing it in yourself. However, let's imagine that we could get this code to compile and run..." Note from the Author or Editor: |
Frederick Kellison-Linn | Nov 22, 2017 | Jun 22, 2018 | |
Chapter 2: A Tour of Rust A Concurrent Mandelbrot Program section |
let bounds = parse_pair(&args[2], 'X') Note from the Author or Editor: |
Jai Sharma | Jan 13, 2018 | Aug 30, 2019 | |
Figure 17-1 UTF-8 Subsection |
Figure 17-1. The UTF-8 encoding in the Code Point Represented column, third row the value should be 0xxxxyyyyyyzzzzzz, instead of the current 0xxxyyyyyyzzzzzz which is missing an x. |
Jai Sharma | Jan 31, 2018 | Jun 22, 2018 | |
ch15 first example in "position, rposition, and ExactSizeIterator" |
'E' is used, but it appears 'e' was intended. Note from the Author or Editor: |
Michael Bolin |
Feb 01, 2018 | Aug 30, 2019 | |
ch15 second example in "position, rposition, and ExactSizeIterator" |
Current. These do not parse because of the capital B. After fixing that, the first assertion still fails because it is a capital E instead of a lowercase one. Note from the Author or Editor: |
Michael Bolin |
Feb 01, 2018 | Aug 30, 2019 | |
Chapter 3 - Floating Point Section |
The "Floating point" section within chapter 3 has a possible error. Note from the Author or Editor: |
James Davis | Feb 20, 2018 | Jun 22, 2018 | |
ePub | Page Figure 19-5 |
In the figure both threads are named "thread 1", whereas the bottom one should be named "thread 2". Note from the Author or Editor: |
Samir Saeedi | Dec 30, 2018 | Aug 30, 2019 |
Utility Traits > Borrow and BorrowMut |
Wrong, currently in print: String implements AsRef<&str> Note from the Author or Editor: |
Anonymous | Mar 21, 2019 | Aug 30, 2019 | |
chapter 11 Middle of the chapter (I'm reading the book on safarionline) |
trait WriteHtml { Note from the Author or Editor: |
Jingjing Duan | Dec 07, 2019 | ||
ch2 Code block for `escape_time` |
In the listing of the `escape_time` function, there is a line `z = z*z + c;`. In the previous listings, similar lines were formatted with a space around the asterisk, i.e. as `z = z * z + c;`. |
Frederick Kellison-Linn | Nov 20, 2017 | Jun 22, 2018 | |
ch3 Tuples after 3rd code snippet |
"in Chapter 2, we need to pass" -> "in Chapter 2, we needed to pass" |
Frederick Kellison-Linn | Nov 20, 2017 | Jun 22, 2018 | |
16 Chapter 16 Vect<T> section |
let mut buffer = vec![0u8; 1024]; // 1024 zeroed-out bytes Note from the Author or Editor: |
Jai Sharma | Jan 24, 2018 | Jun 22, 2018 | |
Printed | Page 17, 161- First para if "A Simple Web Server", and probably most of chapter "Crates and modules" |
The book doesn't distinguish between packages and crates. On p17 "A Simple Web Server", it states Note from the Author or Editor: |
Joel | Aug 17, 2019 | |
Printed | Page 18 code snippet |
In the code snippet, in the HTML of the page being served, both the inputs have name "n". That seems to be a typo. Input's name is used to refer to the element and its value; two inputs on the form having the same name is a bug. Also, the gcd function written earlier has two parameters named n and m, so it only makes sense for the inputs to have the same names: n and m. Note from the Author or Editor: |
owlish | Feb 03, 2019 | |
Printed | Page 42 Code block |
The function `parse_pair` has a bug. Indices on Strings in Rust correspond to byte offsets, but the String data is stored as UTF8. Thus, some characters are more than one byte. Indexing to a non-character boundary will panic (abort the program). Note from the Author or Editor: |
Anonymous | Nov 24, 2020 | |
Printed | Page 51 3rd para |
On p50 it says floating point literals are inferred as f64 if both are possible. On p51 it then says Note from the Author or Editor: |
Anonymous | Jan 28, 2019 | |
Page 55,470 7rd paragraph |
"write_bitmap" should be changed to "write_image". Note from the Author or Editor: |
Sungmann Cho | Apr 29, 2018 | Jun 22, 2018 | |
Printed | Page 74 Caption of Figure 4-2 |
"A Vec 32 ..." should be "A Vec<32> ...". Note from the Author or Editor: |
Glyn Normington | Jan 18, 2018 | Jun 22, 2018 |
Mobi | Page 85 That's not page 85 (Kindle doesn't give me page numbers), but Kindle location |
The book says Note from the Author or Editor: |
Yarrow Angelweed | Dec 03, 2017 | Jun 22, 2018 |
Page 88 2nd to last paragraph |
"i32 with pretensions" should be "u32 with pretensions" Note from the Author or Editor: |
Joe Gilray | Mar 04, 2018 | Jun 22, 2018 | |
Page 111 bottom code example |
The book says that the example in the "Distinct Lifetime Parameters" section does not compile. But it compiles just fine on the stable compiler in Rust playground. Note from the Author or Editor: |
themulhern | Apr 08, 2019 | ||
Printed | Page 113 First paragraph |
"In the simplest case, if your function doesn't return any references (or other types that require lifetime parameters), then you never need to write out the lifetimes for your parameters." Note from the Author or Editor: |
Joel | May 12, 2019 | Aug 30, 2019 |
Page 119 C++ code snippet |
File& operator=(const File &rhs) { Note from the Author or Editor: |
Andrei | Feb 08, 2018 | Jun 22, 2018 | |
Printed | Page 138 Second paragraph of "Assignment" section |
"As described in Chapter 4, assignment moves values of noncopyable types, rather than implicitly copying them." Note from the Author or Editor: |
Joel | Aug 04, 2019 | Aug 30, 2019 |
Printed | Page 164 Table in section "Build Profiles" |
The Cargo.toml section used for the command line "cargo build" is [profile.dev] instead of [profile.debug] Note from the Author or Editor: |
Stefan Achatz | Feb 12, 2018 | Jun 22, 2018 |
Page 195 The last sentence of the 2nd paragraph. |
The last sentence "Suppose we have a struct representing a monster in a game" of the 2nd paragraph seems to be out of context. It looks like some codes related to the monster should be presented, but what is actually presented is the broom struct for "The Sorcerer’s Apprentice". Note from the Author or Editor: |
Sungmann Cho | Sep 15, 2018 | Aug 30, 2019 | |
Printed | Page 205 3rd paragraph |
It says "PartialCmp", while the correct name of the trait is PartialOrd. Note from the Author or Editor: |
Ulrik Sverdrup (bluss) | Jan 26, 2018 | Jun 22, 2018 |
Printed | Page 206 3rd paragraph |
The book says: "There's a problem: a File has to be mut". Note from the Author or Editor: |
Ulrik Sverdrup (bluss) | Jan 26, 2018 | Jun 22, 2018 |
Printed | Page 228 Figure 10-7 |
The pattern in fig 10-7 seems to have a typo: "&Point3d { x, y, x }" should be "&Point3d { x, y, z }". |
Jussi Kukkonen | Mar 04, 2018 | Jun 22, 2018 |
Printed | Page 261 2nd paragraph |
Duplication of word in first sentence: "that that". Note from the Author or Editor: |
Andre Richter | Mar 05, 2018 | Jun 22, 2018 |
ePub | Page 268 last paragraph |
The statement "All of Rust’s numeric types implement std:: ops:: Neg, for the unary negation operator -;" probably is incorrect. My understanding is that the unary negation operator is implemented only for signed types, and that it is not implemented for the unsigned integer types u8, u16, u32, u64, u128, and usize because these types cannot represent negative numbers. Note from the Author or Editor: |
Tom Phinney | Jan 27, 2018 | Jun 22, 2018 |
Page 269 2nd code snippet |
The code snippet is described as "how we might write a generic implementation of negation for Complex values". The code shown uses two generic type parameters T and O. However, there's no need to use two as using two suggests that the example is a mixed-type operation with a different output type. It seems better to use a simpler example. Note from the Author or Editor: |
Michael Galero | Oct 26, 2018 | ||
ePub | Page 269 Code between 1st and 2nd paragraph |
In the last line of code, 'assert_eq!(r + &1009, 1729)', it looks like we are in danger of checking equality between references to integer values, i.e. &factorial(6) and &1009, and the integer value 1729. Instead, the '+' operator seems to be able to is deference up to 1 time, to add the referred-to values and return the answer as a value, so that the assert_eq! works with operands of the same type. I don't think the deferencing behaviour of the '+' operator had previously been mentioned in the text. Minor point, but it did take a bit of thinking to figure out. Thanks for a great book! |
Duane | Nov 21, 2017 | Jun 22, 2018 |
Page 273 |
code fragment Note from the Author or Editor: |
HIDEMOTO NAKADA | Apr 30, 2018 | Jun 22, 2018 | |
Printed | Page 306 First code example |
In this code example: Note from the Author or Editor: |
Tim Crews | Nov 05, 2018 | |
Page 330 Last paragraph, first sentence |
The sentence "The iterator map returns is, of course, itself a candidate for further adaptation." should be "What the iterator map returns is, of course, itself a candidate for further adaptation.". That is, it should have a "What" in the beginning of the sentence. Note from the Author or Editor: |
Michael Galero | Nov 11, 2018 | Aug 30, 2019 | |
Page 354 the first paragraph |
'And like collect, you’ll need to specify the return type: the preceding example writes out the type of living and nonliving, and lets type inference choose the right type parameters for the call.' Note from the Author or Editor: |
HIDEMOTO NAKADA | Apr 30, 2018 | Jun 22, 2018 | |
Page 354 4th paragraph (after the listing of the partition signature) |
The explanation of the partition signature mentions the return type's trait bounds to implement std::default::Extend, whereas it should be std::iter::Extend. Note from the Author or Editor: |
Christopher Mühl | May 20, 2024 | ||
Page 368 last line of the last bullet point |
The correct return type of split_last() is Option<(&T, &[T])>, and not Option<(&[T], &T)> that's in the book. Note from the Author or Editor: |
Michael Galero | Oct 03, 2018 | Aug 30, 2019 | |
Page 375 Page 375(353) ch15 End of section 'Building Collections: collect and FromIterator' |
let args = std::env::args().collect::<String>(); Note from the Author or Editor: |
Yisheng XU | Nov 28, 2017 | Jan 05, 2018 | |
Page 378 Figure 16-5 and Figure 16.6 |
1. page 379 description of figure 16-6 Note from the Author or Editor: |
Yisheng Xu | Nov 30, 2017 | Jun 22, 2018 | |
Page 378 the last paragraph |
'Dark gray regions are unused.' |
HIDEMOTO NAKADA | Apr 30, 2018 | Jun 22, 2018 | |
Printed | Page 381 Bullet point after second paragraph |
Text refers to btree_map.split_at but it should be btree_map.split_off (BTreeMap has no split_at method). Note from the Author or Editor: |
Tyson Nottingham | Jul 05, 2020 | |
Page 395 the first paragraph |
'These all draw their definitions from Unicode, as shown in Table 17-0.' Note from the Author or Editor: |
HIDEMOTO NAKADA | Apr 30, 2018 | Jun 22, 2018 | |
Page 398 "Creating String Values" section, bullet points |
The list enumerates "a few common ways to create String values". It's a little strange that the list doesn't include `String::from` and `format!`. Note from the Author or Editor: |
Michael Galero | Oct 03, 2018 | ||
Printed | Page 400 Code snippet above second paragraph from the bottom of the page |
let parenthetical = "(".to_string() + string + ")"; Note from the Author or Editor: |
Petros Angelatos | Feb 03, 2018 | Jun 22, 2018 |
Page 408 in the middle. |
'as we did for the `Complex` type earlier in the book:' Note from the Author or Editor: |
HIDEMOTO NAKADA | Apr 30, 2018 | Jun 22, 2018 | |
Page 409 the first sentence |
'as do the functions like [T]::binary_search.' Note from the Author or Editor: |
HIDEMOTO NAKADA | Apr 30, 2018 | Jun 22, 2018 | |
Page 410 the last paragraph |
"The nub of the problem is that sometimes the return value of `name` should be..." Note from the Author or Editor: |
HIDEMOTO NAKADA | Apr 30, 2018 | Jun 22, 2018 | |
Page 434 4th paragraph |
reader.read_to_end returns type of io::Result<usize> rather than io::Result<()>. Note from the Author or Editor: |
HoNooD | Jan 22, 2018 | Jun 22, 2018 | |
Page 463 4th paragraph from back |
"The closure we passed to spawn has a return type of io::Result<()>. because that’s what process_files returns." |
HoNooD | Feb 01, 2018 | Jun 22, 2018 | |
Page 476 2nd paragraph |
The paragraph describes that "all the work [...] is done by the function make_single_file_index". However, there's no make_single_file_index function call in the code being described in the previous page (page 475). It seems it's referring to `InMemoryIndex::from_single_document` function call that returns the index. Perhaps the code has changed but the paragraph wasn't updated. Note from the Author or Editor: |
Michael Galero | Oct 03, 2018 | Aug 30, 2019 | |
Page 490 Title of sub sub section |
'Multi-producer Channels Using Mutexes' Note from the Author or Editor: |
HIDEMOTO NAKADA | Apr 30, 2018 | Jun 22, 2018 | |
Page 491 figure |
The Figure 19-11 is missing caption Note from the Author or Editor: |
HIDEMOTO NAKADA | Apr 30, 2018 | Jun 22, 2018 | |
Printed | Page 512 code snippet, top of the page |
In the unit test, when the variable 'hand_coded_value' is assigned, I think there is an .into_iter() missing before .collect(). Note from the Author or Editor: |
Jerry | Sep 18, 2018 | Aug 30, 2019 |
Page 522 Just above Figure 20-4 |
'This feature supports extending the #[derive] attribute to handle custom traits, as shown in Figure 20-4.' Note from the Author or Editor: |
HIDEMOTO NAKADA | Apr 30, 2018 | Jun 22, 2018 | |
Page 531 the second to last paragraph |
'But the comment above the definition of the Ascii type says, “Nothing in this module permits the introduction of non-ASCII bytes into an Ascii value.” ' Note from the Author or Editor: |
HIDEMOTO NAKADA | Apr 30, 2018 | Jun 22, 2018 | |
Page 543 the last sentence of the third paragraph |
'Rust infers that the reference’s lifetime must be the RefWithFlag’s argument, which is just what we want: that’s the lifetime of the reference we started with.' Note from the Author or Editor: |
HIDEMOTO NAKADA | Apr 30, 2018 | Jun 22, 2018 | |
Page 543 l. -5 |
' How should Rust know that any restrictions apply to pab’s lifetime?' Note from the Author or Editor: |
HIDEMOTO NAKADA | Apr 30, 2018 | Jun 22, 2018 | |
Page 543 last line |
'If you omit the _marker field, Rust ...' Note from the Author or Editor: |
HIDEMOTO NAKADA | Apr 30, 2018 | Jun 22, 2018 | |
Page 547 Figure 21-2 |
5 8 in the figure should be 8 5, since they are capacity and length. |
HIDEMOTO NAKADA | May 01, 2018 | Jun 22, 2018 | |
Printed | Page 549 First bullet point |
The book states: "After calling `read`, you must treat `*src` as uninitialized memory." However, the Rust language documentation says that `read` "leaves the memory in `src` unchanged" (see https://doc.rust-lang.org/std/ptr/fn.read.html). Note from the Author or Editor: |
Kyle Strand | Apr 22, 2019 | |
Mobi | Page 17115 Figure 17-2 |
(I only used mobi file so I'm not sure the page number in PDF or printed book) Note from the Author or Editor: |
Anonymous | Feb 21, 2018 | Jun 22, 2018 |