Skip to content
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

when using profile overrides for "core" and -Zbuild-std, cargo emits incorrect warning that profile override is unused #10480

Closed
codyps opened this issue Mar 15, 2022 · 1 comment
Labels
C-bug Category: bug

Comments

@codyps
Copy link
Contributor

codyps commented Mar 15, 2022

Problem

Cargo prints a warning: profile package spec `core` in profile `dev` did not match any packages when a profile.dev.package.core section exists in Cargo.toml.

The options specified in the profile.dev.package.core are used, despite the warning.

Command + verbose output showing that the debug-assertions is passed to rustc:

cody@truman profile-core % cargo +nightly check -Zbuild-std=core --target thumbv7em-none-eabihf --verbose
warning: profile package spec `core` in profile `dev` did not match any packages
   Compiling core v0.0.0 (/Users/cody/Library/Caches/rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core)
     Running `/Users/cody/.local/bin/sccache-wrapper2 rustc --crate-name core --edition=2021 /Users/cody/Library/Caches/rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off -C metadata=8c45ea5e23dd0d5b -C extra-filename=-8c45ea5e23dd0d5b --out-dir /Users/cody/p/profile-core/target/thumbv7em-none-eabihf/debug/deps --target thumbv7em-none-eabihf -Z force-unstable-if-unmarked -L dependency=/Users/cody/p/profile-core/target/thumbv7em-none-eabihf/debug/deps -L dependency=/Users/cody/p/profile-core/target/debug/deps --cap-lints allow`

Cargo.toml content:

[package]
name = "profile-core"
version = "0.1.0"
edition = "2021"

[dependencies]

[profile.dev.package.core]
overflow-checks = false
debug-assertions = false

Steps

I've created a sample project here: https://github.com/jmesmon/cargo-bug-profile-core. Run it with the command cargo +nightly check -Zbuild-std=core --target thumbv7em-none-eabihf --verbose or similar.

  1. create a cargo lib package
  2. make it no_std (makes things easier to reproduce here, but not strictly requried)
  3. Add [profile.dev.package.core] debug-assertions = false to the Cargo.toml (or some other profile adjustment)
  4. build with cargo +nightly check -Zbuild-std=core --target thumbv7em-none-eabihf --verbose (or similar)
  5. note the warning: profile package spec `core` in profile `dev` did not match any packages printed, but the debug-assertions option is passed to rustc.

Notes

This specific issue is mentioned in #10118 (comment). It may be related to #8328 (which also is regarding this warning, but not for core)

Version

cody@truman profile-core % cargo +nightly version --verbose
cargo 1.61.0-nightly (65c826642 2022-03-09)
release: 1.61.0-nightly
commit-hash: 65c82664263feddc5fe2d424be0993c28d46377a
commit-date: 2022-03-09
host: x86_64-apple-darwin
libgit2: 1.4.1 (sys:0.14.1 vendored)
libcurl: 7.77.0 (sys:0.4.51+curl-7.80.0 system ssl:(SecureTransport) LibreSSL/2.8.3)
os: Mac OS 12.2.1 [64-bit]
@codyps codyps added the C-bug Category: bug label Mar 15, 2022
@ehuss
Copy link
Contributor

ehuss commented Mar 15, 2022

Thanks for the detailed report and reproduction! The way profile overrides interact with the standard library hasn't been decided upon. This is being tracked in rust-lang/wg-cargo-std-aware#2, so I'm going to close in favor of that.

@ehuss ehuss closed this as completed Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants