The section in the Rust documentation that talks about patching explains how to implement a patch, but all of the examples it uses are for "testing" and short term fixing. What I want to do is make a patch for one of the crates I depend on that bumps its sub-dependencies, and then I would then like to publish my crate with its patched dependencies on crates.io. However, when you create a patch you have to list a path dependency, as in the example:
[patch.crates-io]
uuid = { path = "../path/to/uuid" }
I assume this would prevent me from publishing my crate, since I now have a dependency on something not in crates.io.
So overall my question is: can I publish a crate to crates.io that uses a local patch? If not, is there another workaround for this situation?
It is not possible
Note: crates.io does not allow packages to be published with path dependencies (path dev-dependencies are ignored). See the Multiple locations section for a fallback alternative.
It is possible to specify both a registry version and a git or path location. The git or path dependency will be used locally (in which case the version is checked against the local copy), and when published to a registry like crates.io, it will use the registry version. Other combinations are not allowed.
You will need to have the dependency uploaded to crates.io.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With