Open
Description
Problem
When using the profile-rustflags
Cargo feature with a --cfg
flag, dependency resolution appears to be performed without the additional flag.
Steps
Minimal reproduction:
# Cargo.toml
cargo-features = ["profile-rustflags"]
[package]
name = "cargo-profile-rustflags-bug"
version = "0.1.0"
edition = "2021"
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(unstable)'] }
[target.'cfg(unstable)'.dependencies]
thiserror = "1"
[profile.dev-unstable]
inherits = "dev"
rustflags = ["--cfg=unstable"]
// src/main.rs
#[cfg(unstable)]
use thiserror;
fn main() {
println!("Hello, world!");
}
cargo check
andRUSTFLAGS="--cfg=unstable"
both work finecargo check --profile=dev-unstable
fails (no external crate thiserror
).
Possible Solution(s)
No response
Notes
No response
Version
cargo 1.86.0-nightly (cecde95c1 2025-01-24)
release: 1.86.0-nightly
commit-hash: cecde95c119a456c30e57d3e4b31fff5a7d83df4
commit-date: 2025-01-24
host: x86_64-unknown-linux-gnu
libgit2: 1.9.0 (sys:0.20.0 vendored)
libcurl: 8.9.0-DEV (sys:0.4.74+curl-8.9.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w 11 Sep 2023
os: Ubuntu 22.4.0 (jammy) [64-bit]