I haven’t heard of that being the case. The book’s code is tested in CI. I’m not saying it’s impossible, but I am saying it’s surprising. It’s certainly a bad experience, though, while the author is wrong about many things, he’s right about that.
The current version of the book uses
[dependencies] rand = "0.8.5"
1.31.0 (the oldest I could find with the same URL, I don't remember when exactly the book shipped so maybe it's slightly off but whatever) uses
[dependencies]
rand = "0.3.14"
So yeah that's a lot of differences. But if they used the same code as the book, then it should have worked. So it's possible that:
1. they got an old resource but then used a newer version of rand, maybe by using `cargo add` instead?
2. rand had a breaking change somewhere along the way there, and they got unlucky
Guess we'll never know...
Yeah, they didn't follow the instructions and got burned. I still think that multiple things went wrong simultaneously for that experience. I wonder if more prevalent uses of `#[doc(alias = "name")]` being leveraged by https://github.com/rust-lang/rust/pull/120730 (which now that I check only accounts for methods and not functions, I should get on that!) so that when changing APIs around people at least get a slightly better experience.
Sounds like the author did not specify the correct version of a dependency. It should not be surprising to find an incompatible API if using a (presumably) different major version number of a dependency, right?
I would say that failing to compile seems like a best-case scenario here. Serious question -- what would have been a better result in this situation?