Errata

Programming Rust

Errata for Programming Rust

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Printed Page p 18
4th line from the bottom of the page

Revised 2nd Edition

In the output of "cargo run" we can read "Compiling gcd v0.1.0 (...)" which is at odds with the given example (as described later p 21 and as available on github) where the function gcd is supposed to be written in the main source.

Anonymous  Jul 18, 2022 
Printed Page 2
4th paragraph

On p. 1, the chapter starts with a C code example to demonstrate C's unsafety. On p. 2, paragraph 4, a claim is made: 'Indeed, the preceding program compiles without errors or warnings'.

This claim is incorrect. On clang version 13.0.0, we get a compile warning:

mystery.c:3:3: warning: array index 3 is past the end of the array (which contains 1 element) [-Warray-bounds]
a[3] = 0x7ffff7b36cebUL;
^ ~
mystery.c:2:3: note: array 'a' declared here
unsigned long a[1];
^
1 warning generated.

Yawar Amin  Sep 26, 2022 
Printed Page 45, 47
Program sample

eprintln!("{} failed to write to file '{}': {:?}", "Error".red().bold(), args.filename, e);

Since we failed to write to the output file, we should print the name of the output file.

eprintln!("{} failed to write to file '{}': {:?}", "Error".red().bold(), args.output, e);

Rohit Banga  May 14, 2022 
Printed Page 165
line 19

Minor English grammar error.

Because "errors" is plural, the word "is" should be replaced with "are" within the text "It's easy to forget just how pervasive the possibility of errors is in a program..."

John Westcroft  May 07, 2022 
Printed Page 212
1st code sample on page, top half of page.

The code snippet creates two instances of Broom, `hokey1` and `hokey2` and has a section for assertions on each of the instances.

In the 2nd section of assertions, the value of `hokey1.height` is asserted for a 2nd time, and the value of `hokey2.height` is never asserted.

Peter  Nov 10, 2021 
Printed Page 240
first code block

mislabeled variable, "tree" refers to the Saturn tree from the diagram.

let tree = NonEmpty(Box::new(TreeNode {
element: "Saturn",
left: mars_tree,
right: uranus_tree,
}));

should be refactored as:

let saturn_tree = NonEmpty(Box::new(TreeNode {
element: "Saturn",
left: mars_tree,
right: uranus_tree,
}));

John Westcroft  Jul 08, 2022 
Printed Page 249
3rd paragraph of section "Where patterns are allowed"

There's a typo in the sentence: "..., while in Python, iit's ...". Here "iit's" should be "it's".

Kris van Rens  Jan 07, 2022 
Printed Page 608
table 21-1

2nd Edition.

I see errata reports are being ignored or deleted, but I'll try one more anyway, for the sake of future readers:

The two last entries, "match 0 or 1 times, separated by ...", are wrong since there is no such pattern for the macros. Indeed, there is no need to separate 1 item and even less no items. This is confirmed by the compiler error message:

"the `?` macro repetition operator does not take a separator"

Tested with 1.66.1

Tom  Jan 19, 2023