Be sure you are reading the latest "the rust programming language" book

60 points uranium_99mm

So this just happened to me, i was reading the book and writing code from it. I compile and get a compilation warning and error, having no idea that i am reading an older version i was so confused for 10 mins, until i opened the latest copy of the book, which has refactored code and also better examples than the older version of the book. So just make sure you are reading the latest version of the book, less you are working with old version of compiler.

latest copy:https://doc.rust-lang.org/book/

latest copy with quizzes: https://rust-book.cs.brown.edu/