The time has come to continue my Cargo gripes series.
I had difficulty with certain crate from crates.io which depends on an old version of ratelimit, which has since changed considerably. However, encountering an out of date, failing to compile crate in crates.io was only the beginning of my problems.
Naturally, I first checked the Cargo.toml and there, the correct (old) version was explicitly specified:
ratelimit = “0.4.1”. However, the compiler kept pulling in the latest version “0.4.4” with apparent disregard for Cargo.toml, and failing as a result. Deleting Cargo.lock did not help.
In the end I had to go back to re-reading Cargo manual and reminding myself, that the equal sign in Cargo.toml DOES NOT MEAN specifying the actual listed version at all. That is being done by an obscure first character in the version string itself, that is if you remember that you must add it in.
IMHO this is very confusing and counter-intuitive. The fact that I actually knew this at one time and still got caught in this trap again, only proves it.
PS. It is not only senile old me who suffers from it, as the author of the failing crate did not realise this either.