You can clone with
HTTPS or Subversion.
Lately we've been hitting a lot of problems where rustc picks the wrong version of a crate from multiple candidates. Sometimes this happens from picking the 0.1 crate when it should pick 0.2, sometimes because there are multiple 0.2 crates and it picks the wrong one randomly.
There are two parts to this solution. This first is just being more disciplined about our use statements (#2069).
The second part involves adding a check to creader that there is only a single match. When there are multiple matching crates it will list them and their associated linkage metadata then error. In order to recover from the error the code must create more specific use statements until there is no ambiguity.
This leaves an open problem when there are two matching crates with the same linkage metadata. Usually in this case you just want do delete the old ones, but we could also allow use to match on the crate hash itself.
what to do in the case that multiple libraries with identical metadata are found in various paths?
if they have the exact same meta hash then the one that was found first is chosen.
I guess that leaves open the possibility for the same types of confusion if you have a new version in the working directory but on old version installed and they both have the same version.
Probably the injected use core needs to automatically use the correct version.
If they have the same metadata, they'll have the same hash.
de35288 adds the error when creader finds multiple crates that match for a use statement.
Currently, if you have two copies of the same crate version (not necessarily bit-identical) in two different, searched paths, then rustc will fail. This could impact cargo since it appears to use a scheme where it searches a primary location then a fallback location, then the system default location. In practice, if you use cargo to install libfoo globally then also locally, it will not be usable.
I added an additional sanity check in 5dd1677 that issues a warning when creader decides to use multiple crates with the same name. I realize this is a valid use case and we even have a (broken) test for it under run-pass/crateresolve2.rs, but in all current scenarios this will just lead to mystery bugs.
Considering this done. We can have follow-up bugs for specific issues as they come up.