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

.cargo configuration directory in workspace subcrate #10050

Closed
jdonszelmann opened this issue Nov 6, 2021 · 2 comments
Closed

.cargo configuration directory in workspace subcrate #10050

jdonszelmann opened this issue Nov 6, 2021 · 2 comments
Labels
C-bug Category: bug

Comments

@jdonszelmann
Copy link

Problem

Placing a .cargo directory (with a cargo config file) in the root of a crate can configure cargo. However, when a crate has the following form:

/
    Cargo.toml  (has [worspace] with members a and b
    a/
        Cargo.toml
        src/
    b/
        Cargo.toml
        src/
       .cargo
           config

the .cargo config in b is not used, which is not what I expected. There may be a very good reason for disallowing, but I couldn't find it. Is this expected or unexpected behavior?

Steps

Create a project conform the template in the above section. I created a git repository demonstrating the bug: https://github.com/jonay2000/cargo-bug

Possible Solution(s)

I'm not entirely sure if we should support this (even though it is something I could use). The docs also don't list subcrates under the list of directories cargo looks in. Maybe it would be nice to explicitly state that subcrates are not included.
image

Alternatively, we could support this. I'm not sure what the technical limitations of supporting this are, maybe people with more knowledge about cargo internals could help with this.

Notes

In some sense, this may not be considered a bug, and more of a feature request. Feel free to reclassify it as such.

Version

cargo 1.56.0 (4ed5d137b 2021-10-04)
release: 1.56.0
commit-hash: 4ed5d137baff5eccf1bae5a7b2ae4b57efad4a7d
commit-date: 2021-10-04
@jdonszelmann jdonszelmann added the C-bug Category: bug label Nov 6, 2021
@ehuss
Copy link
Contributor

ehuss commented Nov 6, 2021

Yea, this is currently expected behavior. Cargo searches for config files based on the current working directory where it is launched. I understand that can be potentially confusing. I'm going to close this in favor of #9769.

@ehuss ehuss closed this as completed Nov 6, 2021
@jdonszelmann
Copy link
Author

thanks for the quick reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants