-
Notifications
You must be signed in to change notification settings - Fork 2.7k
docs(guide): Clarify where to set config #16107
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
Conversation
This was originally written for `[profiles]` but we now document `[build]` and `[target]` which are `.cargo/config.toml` only, so we need to add some more nuance.
r? @weihanglo rustbot has assigned @weihanglo. Use |
CC @Kobzol |
- Available to all developers contributing to your project | ||
- Limited in what configuration is supported (see [#12738](https://github.com/rust-lang/cargo/issues/12738) for expanding this) | ||
- [`$WORKSPACE_ROOT/.cargo/config.toml` configuration file](../reference/config.md) | ||
- Available to all developers contributing to your project |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd maybe add something like "(if checked into version control)", as it's less common for config.toml
to be committed than Cargo.toml
which is pretty much always under version control.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I worry that this would become too much of a distraction to mention
- We are not trying to cover every use case here (e.g. I left off having a config above the repo root for the next item)
cargo new
does not ignore it by default- I regularly see it committed in repos
- If someone contributes to random projects, they can't build a workflow around not committing it because repos do commit it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If someone contributes to random projects, they can't build a workflow around not committing it because repos do commit it
Yeah, that annoys me quite a lot, as I then have to keep a git-modified file on disk and ignore it in commits :)
Fair enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or keep your config in the parent directory, requiring extra nesting if its project specific.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or we have -Zconfig-include
and project can explicitly set up a location that is git-ignored but optionally included.
- Available to all developers contributing to your project | ||
- Limited in what configuration is supported (see [#12738](https://github.com/rust-lang/cargo/issues/12738) for expanding this) | ||
- [`$WORKSPACE_ROOT/.cargo/config.toml` configuration file](../reference/config.md) | ||
- Available to all developers contributing to your project |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or we have -Zconfig-include
and project can explicitly set up a location that is git-ignored but optionally included.
- Limited in what configuration is supported (see [#12738](https://github.com/rust-lang/cargo/issues/12738) for expanding this) | ||
- [`$WORKSPACE_ROOT/.cargo/config.toml` configuration file](../reference/config.md) | ||
- Available to all developers contributing to your project | ||
- Unlike `Cargo.toml`, this is sensitive to what directory you invoke `cargo` from (see [#2930](https://github.com/rust-lang/cargo/issues/2930)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why linked to an issue not the official doc?
If the official doc is not clear enough maybe we should update then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The relevant text us buried such that linking to it will make people think we're linking for other reasons and it doesn't get into much of the surrounding context of that issue's discussion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. That makes sense.
Update cargo 17 commits in 81c3f77a467359c8be6bc747dc93ec66a6e4ce11..367fd9f213750cd40317803dd0a5a3ce3f0c676d 2025-10-10 18:41:02 +0000 to 2025-10-15 15:01:32 +0000 - test: Don't look for a specfic ANSI color (rust-lang/cargo#16118) - docs(guide): Clarify where to set config (rust-lang/cargo#16107) - test(rustfix): re-enable disabled test due to unused variables (rust-lang/cargo#16114) - Convert the "manifest has no things" warning to annotate_snippets. (rust-lang/cargo#16113) - doc: make it clearer that `target.<cfg>.linker` is supported (rust-lang/cargo#16112) - docs(guide): Cover feature-unification (rust-lang/cargo#16108) - fix(gctx): types are unsupported not unknown (rust-lang/cargo#16109) - fix(script): Tweak cargo script build-dir / target-dir (rust-lang/cargo#16086) - docs(gctx): explain Value deserialization step-by-step (rust-lang/cargo#16105) - docs(guide): Talk about removing unused features (rust-lang/cargo#16085) - test(config): exercise unsupported TOML types (rust-lang/cargo#16100) - docs(gctx): a bit more of how config deserialization works (rust-lang/cargo#16094) - Refactor `Layout` into `BuildDirLayout` and `ArtifactDirLayout` (rust-lang/cargo#16092) - Add alternative linker to the build performance guide (rust-lang/cargo#15991) - refactor(gctx): extract error to a module (rust-lang/cargo#16091) - fix: Fixed nightly tests failing due to unused_variables lint (rust-lang/cargo#16098) - fix(script): Store cargo script lockfiles in build-dir (rust-lang/cargo#16087) r? ghost
Update cargo 17 commits in 81c3f77a467359c8be6bc747dc93ec66a6e4ce11..367fd9f213750cd40317803dd0a5a3ce3f0c676d 2025-10-10 18:41:02 +0000 to 2025-10-15 15:01:32 +0000 - test: Don't look for a specfic ANSI color (rust-lang/cargo#16118) - docs(guide): Clarify where to set config (rust-lang/cargo#16107) - test(rustfix): re-enable disabled test due to unused variables (rust-lang/cargo#16114) - Convert the "manifest has no things" warning to annotate_snippets. (rust-lang/cargo#16113) - doc: make it clearer that `target.<cfg>.linker` is supported (rust-lang/cargo#16112) - docs(guide): Cover feature-unification (rust-lang/cargo#16108) - fix(gctx): types are unsupported not unknown (rust-lang/cargo#16109) - fix(script): Tweak cargo script build-dir / target-dir (rust-lang/cargo#16086) - docs(gctx): explain Value deserialization step-by-step (rust-lang/cargo#16105) - docs(guide): Talk about removing unused features (rust-lang/cargo#16085) - test(config): exercise unsupported TOML types (rust-lang/cargo#16100) - docs(gctx): a bit more of how config deserialization works (rust-lang/cargo#16094) - Refactor `Layout` into `BuildDirLayout` and `ArtifactDirLayout` (rust-lang/cargo#16092) - Add alternative linker to the build performance guide (rust-lang/cargo#15991) - refactor(gctx): extract error to a module (rust-lang/cargo#16091) - fix: Fixed nightly tests failing due to unused_variables lint (rust-lang/cargo#16098) - fix(script): Store cargo script lockfiles in build-dir (rust-lang/cargo#16087) r? ghost
What does this PR try to resolve?
This was originally written for
[profiles]
but we now document[build]
and[target]
which are.cargo/config.toml
only, so we need to add some more nuance.How to test and review this PR?