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

Use the same version of a transitive dependency #14316

Open
dev-ardi opened this issue Jul 29, 2024 · 1 comment
Open

Use the same version of a transitive dependency #14316

dev-ardi opened this issue Jul 29, 2024 · 1 comment
Labels
A-dependency-resolution Area: dependency resolution and the resolver A-manifest Area: Cargo.toml issues C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

Comments

@dev-ardi
Copy link

dev-ardi commented Jul 29, 2024

Problem

Let's say that I'm using

[dependencies]
reqwest = "0.12.5"
axum = "0.7.5"

But I also want to add tokio as a direct dependency, and I want to match the version that axum uses.
Specifying * as the version could choose either.

Proposed Solution

Something like this

[dependencies]
reqwest = "0.12.5"
axum = "0.7.5"
tokio = "axum"

Notes

No response

@dev-ardi dev-ardi added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage. labels Jul 29, 2024
@epage epage added A-dependency-resolution Area: dependency resolution and the resolver A-manifest Area: Cargo.toml issues S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted. S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix and removed S-triage Status: This issue is waiting on initial triage. labels Jul 29, 2024
@epage
Copy link
Contributor

epage commented Jul 29, 2024

Blocked on rust-lang/rust#44663

As specified, this makes an implementation detail part of a crate's API and would be beholden to semver. A way to solve that is with public/private dependencies. A similar idea was proposed in the RFC. It did require explicitly specify the dependency relationship.

Another approach also came up on Mastadon recently

@alice_i_cecile I’ve started using cargo’s feature:

wgpu.workspace = true

Which is very cool for only having to change things in one place when you have multiple crates.

I really wish you could do something like this though:

wgpu = "bevy_render.wgpu"

So you don’t even have to change that one place.

For the full thread, see https://aus.social/@bnut/112832056643395623

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-dependency-resolution Area: dependency resolution and the resolver A-manifest Area: Cargo.toml issues C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Projects
None yet
Development

No branches or pull requests

2 participants