-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Allow using Cargo-as-a-library with gix's reqwest backend #15653
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
Conversation
r? @weihanglo rustbot has assigned @weihanglo. Use |
@@ -271,10 +271,15 @@ test = false | |||
doc = false | |||
|
|||
[features] | |||
default = ["http-transport-curl"] |
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.
I don't have any objection to this. Let me bring it to the Cargo team's meeting.
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.
The Cargo team has discussed this today during the weekly meeting, and we agree this should be made optional.
Adding the feature to the default
feature is fine as well, since cargo
the library crate bumps its major version in each release.
In the future, we would like to see reqwest or other HTTP backends being options for the entire Cargo, not just for gix.
Thank you for the contribution. Could you rebase onto master so we can possibly merge it?
CI was trying to run |
56e0687
to
2e07157
Compare
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.
What about doing this in xtask-bump-check?
let mut cmd = ProcessBuilder::new("cargo");
cmd.arg("semver-checks")
.arg("check-release")
.arg("--workspace")
.args(&["--exclude", "cargo"]);
gctx.shell().status("Running", &cmd)?;
cmd.exec()?;
// Cargo has multully-exclusive features for different HTTP backends,
// so need to pass `--features` separately
let mut cmd = ProcessBuilder::new("cargo");
cmd.arg("semver-checks")
.arg("check-release")
.args(&["--package", "cargo"])
.args(&["--feature", "all-static"]);
gctx.shell().status("Running", &cmd)?;
cmd.exec()?;
Thank you! Would you mind cleaning up some intermediate and revert commits? |
Update cargo 8 commits in 6833aa715d724437dc1247d0166afe314ab6854e..9b296973b425ffb159e12cf3cd56580fd5c85382 2025-07-13 02:25:52 +0000 to 2025-07-25 17:10:08 +0000 - Allow using Cargo-as-a-library with gix's reqwest backend (rust-lang/cargo#15653) - Make timings graphs scalable to user's window (rust-lang/cargo#15766) - refactor: rename arg `mode` to `intent` (rust-lang/cargo#15774) - fix: `no-proc-macro` is overridden by subsequent edges (rust-lang/cargo#15764) - Use `gix` for `cargo package` (rust-lang/cargo#15534) - cargo-credential-libsecret: give FFI correctly-sized object (rust-lang/cargo#15767) - Remove unnecessary target-c-int-width from target specs (rust-lang/cargo#15759) - Expose artifact dependency getters in cargo-as-a-library (rust-lang/cargo#15753)
What does this PR try to resolve?
Unconditionally enabling "blocking-http-transport-curl" made the
cargo
library incompatible with crates that prefer reqwest. An example being therustsec
crate with git support:Having
cargo
andrustsec
in the same dependency graph makesgix-transport
fail to compile.After this PR, dependency graphs that prefer reqwest can switch to Cargo's http-transport-reqwest feature.
Cargo will continue to have a direct dependency on
curl
, but HTTP operations performed through gix will usereqwest
. This means both curl's HTTP implementation and reqwest's HTTP implementation will be linked. This is still much better than the only existing solution, which is that you must pick versions ofcargo
and other dependency (rustsec
) which depend on semver-incompatible versions of gix, causing 2 entire versions of gix to be linked, in order to sidestep the mutually exclusive features being enabled on the same version of gix. Gix version numbers advance rapidly enough that this is often possible, but sometimes (like right now) you would be unable to use the most recent published release ofcargo
.How to test and review this PR?
cargo check --lib
cargo check --lib --no-default-features --features http-transport-reqwest
Also tested by backporting this commit onto #15391's base commit (i.e. when gix 0.70 was used) to ensure a conflict with rustsec's gix dependency, and successfully building the following project.