-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Description
Top-level overrides with [replace]
as implemented in #2385 require that the replacement has the exact same version number in its Cargo.toml
as the package being replaced. As others have discussed in the PR I think this restriction gets in the way more than it helps.
Here is a workflow I just had. This happens more often than not when I use [replace]
.
- I use some package maintained by someone else. In this case xml-rs.
- I realize I need some functionality to be added in that package. Maybe it just belongs there better, or like here I can’t do it in my own crates because of privacy or trait coherence rules.
- I write and send a pull request: Implement From<std::io::Error> for xml::reader::Error netvl/xml-rs#121 I include a version number increment in the PR to signal to the maintainer that I’d like them to publish this change on crates.io.
- Back in my crate I add a
[replace]
override, which doesn’t work because versions don’t match. I have to revert the version number locally. If I want some else to use my override, I need to push a second branch of the dependency with the same changes but without the version number increment. - Cargo doesn’t let me "update" my dependency (not the replacement) to a version that isn’t published yet.
Maybe the requirement could be that the replacement’s version is SemVer-compatible with the thing being replaced, instead of exactly the same?
mitsuhiko and jplatte
Metadata
Metadata
Assignees
Labels
No labels