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 does not load workspace .cargo/config.toml #14248

Open
chuckliu1979 opened this issue Jul 13, 2024 · 1 comment
Open

cargo does not load workspace .cargo/config.toml #14248

chuckliu1979 opened this issue Jul 13, 2024 · 1 comment
Labels
C-bug Category: bug Command-install S-triage Status: This issue is waiting on initial triage.

Comments

@chuckliu1979
Copy link

chuckliu1979 commented Jul 13, 2024

Problem

my project is a cargo workspace, and i put .cargo/config.toml in workspace root, but seems cargo does not load it:

[source.crates-io]
replace-with = "ustc"

[source.ustc]
registry = "sparse+https://mirrors.ustc.edu.cn/crates.io-index/"

[http]
timeout = 60

[net]
retry = 5

I read cargo docs, it says should find it first

Steps

  1. put .cargo/config.toml in workspace root
  2. cargo install package
  3. source replace-with not work

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.79.0 (ffa9cf99a 2024-06-03)
release: 1.79.0
commit-hash: ffa9cf99a594e59032757403d4c780b46dc2c43a
commit-date: 2024-06-03
host: x86_64-unknown-linux-gnu
libgit2: 1.7.2 (sys:0.18.3 vendored)
libcurl: 8.6.0-DEV (sys:0.4.72+curl-8.6.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Ubuntu 24.4.0 (noble) [64-bit]
@chuckliu1979 chuckliu1979 added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Jul 13, 2024
@epage
Copy link
Contributor

epage commented Jul 13, 2024

This looks similar to #14001

So if I'm understanding, you are wanting cargo install to use the config file from the --git repo, right?

Config is environmental and not tied to the project (#2930, see #12738 for finding ways the right abstraction for representing config in the project). According to these rules, cargo install should use the config of your current-dir independent of where the source is. You can see this if you do cargo check --manifest-path <some-dir> that the config from <some-dir> won't be used, instead requiring something like #10098. For various reasons, cargo install varies from this pattern and only the user-wide configuration is used and not the config for the current-dir.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug Command-install S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

2 participants