-
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
All crates specified with a relative path regarded as workspace members #3156
Comments
Note that the documentation is explicit about the behaviour:
(Emphasis mine) |
@Aatch OK thank you, so this is not a bug so I will close the issue. I still think that there should be saner defaults, so would you suggest I create a new issue or possibly comment on the RFC? Also what documentation did you cite? |
Actually, I was just pointing out that the documentation states the current behaviour. I actually disagree with it. Probably should keep this issue open. |
Oh alright. That's I'll edit my post though to show that it is not a bug |
I think that there are two problems here:
[package]
name = "test"
[dependencies.foo]
path = "../foo"
[workspace]
members = [] This
But |
Note that the implementation was tweaked from the exact wording of the RFC, all transitive In that sense it looks like this is behaving as expected in that case? (albeit unfortunately) |
So all path dependencies are implicitly added to
For me it was unexpected, since it's not documented anywhere. The cargo docs only say:
(emphasis mine) and
But none of these rules explains the error in the above case (#3156 (comment)). It has an explicit |
Indeed!
Ah oops! Sounds like a PR to the docs is in order.
Cargo visiting all path deps transitively would explain this though, right? |
I would also prefer that it's possible to import crates by path without making them members. |
Thanks for the clarification, @alexcrichton! This rule indeed explains the error message in my example. However, I still don't like the rule. It makes it harder to work with local dependencies (e.g. a library that should be published to crates.io eventually and thus shouldn't be part of any workspace). It also means that temporary overriding a dependency with a local copy (e.g. to test a new feature) doesn't “just work” anymore ( |
For example if you want to use a local library in multiple, distinct crates.
Sorry for the bad phrasing. Dependency overriding works fine. I just meant naive overwriting directly in the [dependencies]
#bitflags = "0.7.0"
bitflags = { path = '../bitflags' } I always did this before I learned about the “right” way. |
Ah ok, thanks for clarifying! I think both of those cases are covered by #3159 as well, right? (the ability to a workspace to say "don't include this dir") |
I think they are separate issues.
|
Ok, adding a way to disable transitive inclusion seems plausible to me! Want to open a separate, focused issue on that? |
Great! I opened #3192 for it. |
Overview
According to the workspace RFC:
This makes testing crates that one is working on with a workspace project very difficult. A saner default would be to only include all paths below the project root in the workspace. One can override this with the
.cargo/config
file, however this is much less convinient.The RFC also emphasises the fact that this default is used only when a members key is not defined. However cargo still uses all assumes all path dependancies as members regardless if the members key is defined or not.
Meta
This issue was inspired by phil-opp/blog_os#234, That project is compiled using xargo with a custom target. The issue occured while I was working on a subcrate, and have not created an SSCCE, although I can if it the bug proves to be elusive.
The text was updated successfully, but these errors were encountered: