-
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
Cargo incorrectly detects a package name conflict when a workspace package has the same name as a (transitive) dependency #12891
Comments
The challenge is you're dealing with layers of calculations. We first look up a package and then the relevant command does what it wants with it. We also don't know what bins are in package unless we parse the manifest. So for this to fully work as requested, we'd need to cross layers and then load the manifests to resolve the ambiguity. We'd need the ambiguity resolution to be unambiguous to the user since (1) they might not be aware of details and (2) they can make mistakes. Something I've considered is
If we could prioritize workspace members with a warning saying other options are available and still error when all else is equal, I think that might be good enough. |
But why would |
I didn't say that part was ideal. I was more explaining why it is the way it is and the challenge with changing it to something else. |
#8157 also touches on the problems with us evaluating the available packages before the available binaries. |
Hello, this is of interest also in the semver trick approach https://github.com/dtolnay/semver-trick to add compatibility code (e.g. for serialization) to an old version of a crate by depending on a more recent version of the crate and adding bridge/glue code in the old crate allowing users of the old crate to use a minor release to proceed with serialization format update for example. |
- adding the tfhe package as a dependency is currently causing issues with Cargo because of unified feature resolution it seems, it needs an additional version specifier to disambiguate which package we are referring to, an issue exists on their end but I don't think a fix is to be expected soon rust-lang/cargo#12891 - commiting this to main and then backporting the relevant pieces to 0.4.x
- adding the tfhe package as a dependency is currently causing issues with Cargo because of unified feature resolution it seems, it needs an additional version specifier to disambiguate which package we are referring to, an issue exists on their end but I don't think a fix is to be expected soon rust-lang/cargo#12891 - commiting this to main and then backporting the relevant pieces to 0.4.x
a workaround seems to not specify the package at all, this is an issue if you have several crates with colliding binary/example names I guess i.e. if you have unique names for binaries/examples you can cargo run --release --bin my_bin as long as my_bin has a unique name in the workspace it should be run ok, adding -p my_package when my_package is also a transitive dependency brings you back to the original issue where the name is ambiguous, but running with the spec is not accepted |
- adding the tfhe package as a dependency is currently causing issues with Cargo because of unified feature resolution it seems, it needs an additional version specifier to disambiguate which package we are referring to, an issue exists on their end but I don't think a fix is to be expected soon rust-lang/cargo#12891 - commiting this to main and then backporting the relevant pieces to 0.4.x
- adding the tfhe package as a dependency is currently causing issues with Cargo because of unified feature resolution it seems, it needs an additional version specifier to disambiguate which package we are referring to, an issue exists on their end but I don't think a fix is to be expected soon rust-lang/cargo#12891 - commiting this to main and then backporting the relevant pieces to 0.4.x
- adding the tfhe package as a dependency is currently causing issues with Cargo because of unified feature resolution it seems, it needs an additional version specifier to disambiguate which package we are referring to, an issue exists on their end but I don't think a fix is to be expected soon rust-lang/cargo#12891 - commiting this to main and then backporting the relevant pieces to 0.4.x
- adding the tfhe package as a dependency is currently causing issues with Cargo because of unified feature resolution it seems, it needs an additional version specifier to disambiguate which package we are referring to, an issue exists on their end but I don't think a fix is to be expected soon rust-lang/cargo#12891 - commiting this to main and then backporting the relevant pieces to 0.4.x
This also occurs with |
Problem
Take a project directory structure like this:
Cargo.toml
:examples/grid/Cargo.toml
:Dependency tree:
When you try to run the
grid
example withcargo run --package grid
you get an error:Steps
cargo run --package grid
cargo run --package [email protected]
Possible Solution(s)
The problem seems to be that cargo sees the transitive
grid
dependency oftaffy
and sees that as a conflict with the package of the same name in the local workspace. This must be a bug because there is no reason to run a binary target from a (transitive) dependency withcargo run
. And even if there was, thegrid
crate doesn't have a binary target so there's nothing to run.The solution suggested by cargo is also not correct because running
cargo run -p [email protected]
gives the error that the package is not found in the workspace.A workaround is to use globally unique package names in workspaces but this is very restrictive because adding a dependency can easily create a new conflict.
Notes
No response
Version
The text was updated successfully, but these errors were encountered: