Cargo patch is finickier than it needs to be
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 15.5k
- Forks
- 3k
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 51
Description
The current form of the [patch] section is that you do something like:
[patch.crates-io]
foo = { path = "../../foo" }
or
[patch."https://github.com/manishearth/foo"]
foo = { path = "../../foo" }
Right off the bat, having to make this choice is really unnecessary, having overlapping crates is rare. It would be nice if we just supported
[patch."*"]
foo = { path = "../../foo" }
Furthermore, a lot of crates are multiple crates in a single repo, and in such cases you usually want to pull in all of them
[patch.crates-io]
serde = { path = "../../serde" }
serde-derive = { path = "../../serde/derive" }
// etc
It would be nice if you could just say something like
[patch.crates-io]
serde* = { path = "../../serde" }
and it would look for all the crates it needs in that folder. Even if we don't support wildcards, supporting path dependencies that are able to do a directory tree search (the results of which would be cached in the lockfile anyway) would be nice.
If we don't end up doing this, it would be pretty nice to at least have diagnostics for the situation when:
- You try to patch a git dep with crates-io or vice versa
- You patch a single git dep from a repo containing multiple
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named. Start by tracing Cargo's [patch] handling and dependency-source validation, then clarify whether wildcard sources, crate-name wildcards, directory searches, or diagnostics are in scope. Done means the chosen behavior is agreed, implemented, and covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100