rust-lang / rust-lang/cargo

Provide better diagnostics when patching fails

Open
#7,161 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-diagnostics A-patch S-needs-design
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

There is one particular case I keep hitting that's a papercut for me. Servo uses a mixture of git and crates.io dependencies, and sometimes we end up switching between the two so it's easy to forget the true source of a dependency. When adding a patch, we either need a [patch.crates-io] or [patch."https://github.com/servo/whatever"]. When I get this wrong, however, all I get is a message from Cargo that says that the patch was ignored. It seems like it should be possible for Cargo to notice when a patch matches the name of an existing dependency, check whether the patch source differs from the dependency's source and provide a better error message in that case.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing Cargo's patch resolution and the diagnostic path that reports an ignored patch. Reproduce the mismatch between a dependency source and a patch source, then verify that the resulting message explains which patch section is required and why the patch was ignored.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.