Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo fails when patch overrides only a git branch #5615

Closed
olix0r opened this issue Jun 7, 2018 · 1 comment
Closed

cargo fails when patch overrides only a git branch #5615

olix0r opened this issue Jun 7, 2018 · 1 comment

Comments

@olix0r
Copy link

olix0r commented Jun 7, 2018

I have two crates: conduit-proxy and tower-h2. conduit-proxy depends on tower-h2 via a git dependency:

tower-h2              = { git = "https://github.com/tower-rs/tower-h2" }

I add another crate into the tower-h2 repo, tower-h2-balance. Before I merge tower-h2-balance to master, I want to test it in conduit-proxy, so I add a dependency:

tower-h2-balance      = { git = "https://github.com/tower-rs/tower-h2" }

Then, I'd like to patch these dependencies to use my working branch in the tower-h2 repo:

[patch."https://github.com/tower-rs/tower-h2"]
tower-h2         = { git = "https://github.com/tower-rs/tower-h2", branch = "ver/tower-h2-balance" }
tower-h2-balance = { git = "https://github.com/tower-rs/tower-h2", branch = "ver/tower-h2-balance" }

This is especially necessary because tower-h2 is a diamond dependency (i.e. it is also depended on by another dependency of conduit-proxy), and so it's important that these middle dependencies are patched to use the proper version of tower-h2.

After making this change, cargo check emits the following error:

error: failed to resolve patches for `https://github.com/tower-rs/tower-h2`

Caused by:
  patch for `tower-h2` in `https://github.com/tower-rs/tower-h2` points to the same source, but patches must point to different sources

Is this expected to work? If not, is there a suggested workaround?

For now, I've used .cargo/config to override the dependency, but this is brittle (and I get a big ugly warning about it).


active toolchain
----------------

stable-x86_64-apple-darwin (default)
rustc 1.26.2 (594fb253c 2018-06-01)
:; cargo version
cargo 1.26.0 (0e7c5a931 2018-04-06)
@olix0r olix0r changed the title cargo fails when a patch section to overrides only a git branch cargo fails when a patch section overrides only a git branch Jun 7, 2018
@olix0r olix0r changed the title cargo fails when a patch section overrides only a git branch cargo fails when patch overrides only a git branch Jun 7, 2018
@alexcrichton
Copy link
Member

This is unfortunately a bug in Cargo right now, and I think it's a duplicate of #5478 so closing in favor of that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants