Open
Description
Problem
When building a project that has [patch]
es configured with -Zbuild-std
cargo will log warnings that those patches are unused, even when they are used.
Steps
> cargo new foo && cd foo
Creating binary (application) `foo` package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
> cargo add serde
Updating crates.io index
Adding serde v1.0.203 to dependencies
Updating crates.io index
Locking 7 packages to latest compatible versions
> mkdir .cargo
> echo '[patch.crates-io]\nserde.git = "https://github.com/serde-rs/serde"' > .cargo/config.toml
> cargo check
Updating git repository `https://github.com/serde-rs/serde`
Locking 2 packages to latest compatible versions
Adding serde v1.0.203 (https://github.com/serde-rs/serde#7aafa263)
Adding serde_derive v1.0.203 (https://github.com/serde-rs/serde#7aafa263)
Checking foo v0.1.0 (/tmp/scratch.rust-unwrapped.2024-06-03T15-10.uk9NtZ/foo)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.30s
> cargo check -Zbuild-std --target x86_64-unknown-linux-gnu
Updating git repository `https://github.com/serde-rs/serde`
warning: Patch `serde v1.0.203 (https://github.com/serde-rs/serde#7aafa263)` was
not used in the crate graph.
Check that the patched package version and available features are compatible
with the dependency requirements. If the patch has a different version from
what is locked in the Cargo.lock file, run `cargo update` to use the new
version. This may also occur with an optional dependency that is not enabled.
Checking foo v0.1.0 (/tmp/scratch.rust-unwrapped.2024-06-03T15-10.uk9NtZ/foo)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.20s
Possible Solution(s)
Probably remove the patches from the context while building the sysroot, I wonder if this actually allows patching std
's dependencies currently 🤔.
Notes
No response
Version
cargo 1.80.0-nightly (0de7f2ec6 2024-05-17)
release: 1.80.0-nightly
commit-hash: 0de7f2ec6c39d68022e6b97a39559d2f4dbf3930
commit-date: 2024-05-17
host: x86_64-unknown-linux-gnu
libgit2: 1.7.2 (sys:0.18.3 vendored)
libcurl: 8.6.0-DEV (sys:0.4.72+curl-8.6.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w 11 Sep 2023
os: NixOS 24.5.0 [64-bit]