Resolve dependencies based on feasible target/target_os platform combinations #15563
Labels
A-dependency-resolution
Area: dependency resolution and the resolver
A-lockfile
Area: Cargo.lock issues
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Command-vendor
S-triage
Status: This issue is waiting on initial triage.
Problem
There are a few related issues to this: #5896 is maybe the closest.
Concrete example:
I want to use the
webbrowser
crate.webbrowser
depends onjni
fortarget_os = android
https://github.com/amodm/webbrowser-rs/blob/eff4ccbfd373e88df5dbfd6337eabd69b60b08be/Cargo.toml#L34-L35
The latest released
jni
depends onwindows-sys
fortarget = windows
https://github.com/jni-rs/jni-rs/blob/c79df460a2ca06984e35f67be8ddc13dfab542a7/Cargo.toml#L37-L38
Independent of build target this version of
windows-sys
will never be used.Proposed Solution
Have the resolver figure out that
windows-sys 0.45
will never be a dependency ofwebbrowser
and therefore not of my project.Notes
Now, I realize that one says
target_os
and the other is just the general "windows", so maybe it depends on that. But if the resolution could take these things into account (which I do not think it does, even if it usingtarget_os = "windows"
, but correct me if I am wrong), that will help de-bloating Cargo.lock.The text was updated successfully, but these errors were encountered: