2

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"] } 

1 Answer 1

2

If pkg_b requires pkg_a ^0.1.0 (meaning "between 0.1.0 and 0.2.0", see caret requirements in Cargo), you can't make it accept pkg_a 0.2.0 as a dependency, even if you patch the registry to make local pkg_a repository discoverable. Maintaining a patch for pkg_b/Cargo.toml seems like your best bet.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.