-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support [patch] in .cargo/config files #9204
Conversation
This patch adds support for `[patch]` sections in `.cargo/config.toml` files. Patches from config files defer to `[patch]` in `Cargo.toml` if both provide a patch for the same crate. The current implementation merge config patches into the workspace manifest patches. It's unclear if that's the right long-term plan, or whether these patches should be stored separately (though likely still in the manifest). Regardless, they _should_ likely continue to be parsed when the manifest is parsed so that errors and such occur in the same place regardless of where a patch is specified. Fixes rust-lang#5539.
r? @Eh2406 (rust-highfive has picked a reviewer for you, use r? to override) |
I'm a bit wary about modifying the patch tables so deep in the manifest, it seems like this would emulate a |
Good point! I placed the parsing there because I wanted to re-use I'm also a little unsure about cargo/src/cargo/core/workspace.rs Lines 394 to 398 in 140a770
The patch tables are stored as # Cargo.toml
[patch.crates-io]
nom5 = { ..., version = "5" }
nom6 = { ..., version = "6" } # .cargo/config
[patch.crates-io]
nom = { ..., version = "5" } Can that even happen? What's the expected outcome in this case? |
☔ The latest upstream changes (presumably #9181) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably #8825) made this pull request unmergeable. Please resolve the merge conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for the delay, but this version looks good to me! Ia've got some minor thoughts inline, but otherwise r=me
@alexcrichton Excellent, all good comments — I've pushed fixes in b50cde8. I don't think bors picked up your r= though? |
@bors: r+ Oh that's not an actual feature of bors, it's more of "I won't take XX days to review this next time, I'll write r+ soon after I see the email it was updated" |
📌 Commit b50cde8 has been approved by |
☀️ Test successful - checks-actions |
Will do! Should we leave this open as a tracking issue? What do you envision as the stabilization path for this feature? |
I think it's fine to open a new issue, it doesn't matter too much. The "new issue" button should have a template for a tracking issue. |
Oh, and I'm not sure exactly what needs to happen to stabilize. We don't have a clear process for that, since it doesn't happen too often. 😜 Normally we let it bake on nightly for a while, to let people to try it out and see if there are any issues, and to gain more experience with it. This also gives some time to consider if it is the right design and something that we actually want to commit to. |
Update cargo 8 commits in 32da9eaa5de5be241cf8096ca6b749a157194f77..90691f2bfe9a50291a98983b1ed2feab51d5ca55 2021-03-13 01:18:40 +0000 to 2021-03-16 21:36:55 +0000 - Add report if `cargo fix --edition` changes features. (rust-lang/cargo#9268) - Fix --feature pkg/feat for V1 resolver for non-member. (rust-lang/cargo#9275) - Fix doc duplicate removal of root units. (rust-lang/cargo#9276) - Add CLI help text for patch-in-config (rust-lang/cargo#9271) - Document `-Zpatch-in-config` (rust-lang/cargo#9270) - Support [patch] in .cargo/config files (rust-lang/cargo#9204) - Add `--future-incompat-report` support to `cargo test` (rust-lang/cargo#9264) - 🍱 Crop favicon (rust-lang/cargo#9262)
This patch adds support for
[patch]
sections in.cargo/config.toml
files. Patches from config files defer to
[patch]
inCargo.toml
ifboth provide a patch for the same crate.
The current implementation merge config patches into the workspace
manifest patches. It's unclear if that's the right long-term plan, or
whether these patches should be stored separately (though likely still
in the manifest). Regardless, they should likely continue to be
parsed when the manifest is parsed so that errors and such occur in the
same place regardless of where a patch is specified.
Fixes #5539.