According to the Multiple Locations session of the cargo reference, it is possible to define both git and version locations when specifying a dependency.
It is not possible though, to add a registry to the version, so for instance:
# Works fine
my-dependency = {"version" = "1.0", git = "my-repo", branch = "my-branch"}
# Errors with message: "Only one of `git` or `registry` is allowed."
my-dependency = {"version" = "1.0", registry = "my-registry", git = "my-repo", branch = "my-branch"}
There is nothing that I could find about this in the cargo documentation link above, and it is not clear to me why this is not allowed if it works for "crates.io". Any thoughts?
Hi @kornel, thanks for the reply and the reference!
Backwards compatibility make sense
I still find it a bit weird that there is no documentation about this anywhere, though, and even the way it is written in the docs is misleading in my opinion:
... and when published to a registry like crates.io, it will use the registry version.
I might ask this question in the Github repository to see if it is an oversight or backwards compat and get more context on the reasoning behind the implementation