Cargo: Unused patch warnings when using `-Zbuild-std` with `-Zbuild-std-features=compiler-builtins-mem`

Created on 10 Dec 2020  路  3Comments  路  Source: rust-lang/cargo

Problem

There are multiple Patch [...] was not used in the crate graph warnings when building a project using -Zbuild-std and -Zbuild-std-features=compiler-builtins-mem on nightly:

Warning output

warning: Patch gimli v0.23.0 (/home/philipp/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/vendor/gimli) was not used in the crate graph.
Patch object v0.22.0 (/home/philipp/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/vendor/object) was not used in the crate graph.
Patch adler v0.2.3 (/home/philipp/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/vendor/adler) was not used in the crate graph.
Patch addr2line v0.14.0 (/home/philipp/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/vendor/addr2line) was not used in the crate graph.
Patch miniz_oxide v0.4.0 (/home/philipp/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/vendor/miniz_oxide) 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.

Steps

  1. cargo new --lib example && cd example
  2. echo "#![no_std]" > src/lib.rs
  3. cargo +nightly check --target x86_64-unknown-linux-gnu -Z build-std=core -Zbuild-std-features=compiler-builtins-mem

(The actual target doesn't seem to matter, the build-std feature just requires that we pass a --target argument.)

Notes

These warnings appeared between https://github.com/rust-lang/cargo/compare/d5556aeb8...2af662e22. My guess is that https://github.com/rust-lang/cargo/pull/8834 introduced them. They still happen on the latest nightly.

Output of cargo version:

cargo 1.50.0-nightly (d274fcf86 2020-12-07)
release: 1.50.0
commit-hash: d274fcf862b89264fa2c6b917b15230705257317
commit-date: 2020-12-07


C-bug

Most helpful comment

Ah yes this is indeed caused by #8834. There's some discussion on https://github.com/rust-lang/cargo/issues/8962 about the impact of that PR and how we may back it out.

All 3 comments

Ah yes this is indeed caused by #8834. There's some discussion on https://github.com/rust-lang/cargo/issues/8962 about the impact of that PR and how we may back it out.

Are there currently any workarounds for this?

Oh this was actually fixed in https://github.com/rust-lang/cargo/pull/8968, and now it's just updating the Cargo submodule in rust-lang/rust. In the meantime there are no workarounds.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

japaric picture japaric  路  3Comments

fprijate picture fprijate  路  3Comments

ckaran picture ckaran  路  3Comments

oblique picture oblique  路  3Comments

SimonSapin picture SimonSapin  路  3Comments