Skip to main content
edited tags
Link
Shepmaster
  • 439.3k
  • 116
  • 1.3k
  • 1.5k
Source Link
atx
  • 5.1k
  • 3
  • 30
  • 42

How to patch crates-io with path using Cargo?

In my Rust crate I need to be able to use 2 git repositories both checked out in the root of my crate. They are both modified and pkg_b requires an older version of pkg_a, 0.1.0. I can't seem to get pkg_b to use the newer version of pkg_a, 0.2.0. My current workaround has been to just update the Cargo.toml file in pkg_b.

My crate's Cargo.toml:

[package] name = "mypkg" version = "0.1.0" [dependencies] pkg_a = { path = "./pkg_a" } # This is 0.2.0 with my changes added pkg_b = { path = "./pkg_b" } [patch.crates-io] pkg_a = { path = "./pkg_a", features = ["serde_support"] } 

And pkg_b's Cargo.toml:

[package] name = "pkg_b" version = "0.1.0" [dependencies] pkg_a = { version = "0.1.0", features = ["serde_support"] }