-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Weird behavior with target.cfg.dependencies/build-dependencies #9216
Labels
Comments
@eddyb suggested adding [package]
name = "rusttest"
version = "0.1.0"
edition = "2018"
resolver = "2"
[target.'cfg(windows)'.dependencies]
bitflags = ""
[target.'cfg(not(windows))'.build-dependencies]
bitflags = "" and uh,
Backtrace, click to expand
|
ehuss
added
the
A-dependency-resolution
Area: dependency resolution and the resolver
label
Mar 1, 2021
@ehuss @alexcrichton |
This was an unintended regression introduced by #8777 (first released in 1.49). I can try to take a look. |
ehuss
pushed a commit
to ehuss/cargo
that referenced
this issue
Mar 12, 2021
Fix issue with filtering exclusive target dependencies. rust-lang#8777 incorrectly changed the filtering logic for dependencies. Essentially it split `filter(any(A && B && C && D))` into two parts `filter(any(A && B)).filter(any(C && D))` which doesn't have the same meaning. The solution here is to pass a closure so that the conditions are joined again. Fixes rust-lang#9216
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
For this
src/lib.rs
, compiling with various configurations produces some weird results. I'm usingbitflags
as a random example, I don't think there's anything special about it:This Cargo.toml fails, as expected (I am on linux, flip to
cfg(unix)
or whatever if you're on windows):This Cargo.toml also fails, as expected, with the same error.
But, this Cargo.toml succeeds compilation, very unexpectedly (with a
warning: unused import: bitflags
):Is this intended behavior? This seems really weird and not at all what I expected. The first example shows that
target.'cfg(windows)'.dependencies
is not included in builds on linux. The second example shows thattarget.'cfg(not(windows))'.build-dependencies
(which is enabled on linux) does not "leak" into the main program. So why, when combined together, does the build succeed?Output of
cargo version
:cargo 1.50.0 (f04e7fab7 2021-02-04)
Also reproduces on
cargo +nightly version
:cargo 1.52.0-nightly (572e20153 2021-02-24)
Discovered while trying to investigate the issues hit in EmbarkStudios/rust-gpu#423
The text was updated successfully, but these errors were encountered: