I’m sure there might be some good reason for it, but it seems unfortunate that simple errata like this would be withheld from the “stable” book for many months. I’ll just have to remind myself to always look at https://doc.rust-lang.org/nightly/book , now that I know this. Thanks!
There were some other odd things about this particular example, but my above referenced issue was closed without further comment. Lost in the volume of issues I guess.
@gera-k: It was a design choice that now can’t be changed. There are some potentially legitimate cases for returning non-
std::error::Error types as the E in
Result<T, E>, for example:
Here, one could argue that some other enum besides
std::result::Result could have been used. I know I’ve seen some other cases of functions where something is passed by value (moved), and in the event of a failure, passed back as the
Err(E) but I couldn’t find one immediately in libstd. Anyone?
In the ecosystem there have been other cases where even custom error types aren’t
std::error::Error, usually just an unintentional omission.