Cargo.toml dependency rev+version use cases

Hey!

What are use cases for specifying both rev and version for git dependency in Cargo.toml?

[dependencies]
some-dep = { git = "https://github.com/some/dep", rev = "1847fab", version = "0.1.0" }

Those look mutually exclusive to me but for some reason I'm allowed to specify both.

I don't know the original reasoning, but two use cases are:

  1. Assertion - if rev of git isn't version, the project won't compile, and you get a nice error message explaining the problem.
  2. Documentation
1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.