-
Notifications
You must be signed in to change notification settings - Fork 2.7k
feat(config-include): support inline and array of tables #16174
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
Merged
Merged
+237
−68
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show that config `include` expects a string or list of strings
3 tasks
Both are now supported
```
include = ['simple.toml', { path = 'other.toml' }]
```
```
[[include]]
path = 'first.toml'
[[include]]
path = 'second.toml'
```
So in the future we can extend field like `optional` or `if`
in the include table
On the implementation side,
`ConfigInclude` intentionally doesn't derive serde deserialization
to avoid any misuse of `GlobalContext::get::<ConfigInclude>()`,
which might lead to wrong config loading order.
e268401 to
25d7318
Compare
epage
approved these changes
Oct 30, 2025
bors
added a commit
to rust-lang/rust
that referenced
this pull request
Nov 1, 2025
Update cargo submodule 6 commits in 6c1b6100343691341b9e76c5acc594e78220f963..6368002885a04cbeae39a82cf5118f941559a40a 2025-10-28 16:27:52 +0000 to 2025-10-31 14:31:52 +0000 - feat(build-analysis): emit timing-info log (rust-lang/cargo#16179) - Remove libc pin message (rust-lang/cargo#16182) - feat(config-include): add optional field support (rust-lang/cargo#16180) - feat(config-include): support inline and array of tables (rust-lang/cargo#16174) - test(script): Update from rustc's test suite (rust-lang/cargo#16169) - Fix links for options in man pages (rust-lang/cargo#16172) r? ghost
bors
added a commit
to rust-lang/rust
that referenced
this pull request
Nov 1, 2025
Update cargo submodule 6 commits in 6c1b6100343691341b9e76c5acc594e78220f963..6368002885a04cbeae39a82cf5118f941559a40a 2025-10-28 16:27:52 +0000 to 2025-10-31 14:31:52 +0000 - feat(build-analysis): emit timing-info log (rust-lang/cargo#16179) - Remove libc pin message (rust-lang/cargo#16182) - feat(config-include): add optional field support (rust-lang/cargo#16180) - feat(config-include): support inline and array of tables (rust-lang/cargo#16174) - test(script): Update from rustc's test suite (rust-lang/cargo#16169) - Fix links for options in man pages (rust-lang/cargo#16172) r? ghost
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-configuration
Area: cargo config files and env vars
Z-config-include
Nightly: `include` config key
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR try to resolve?
Part of #7723 (comment)
Both are now supported:
and
So in the future we can extend field like
optionalorifin the include table
How to test and review this PR?
On the implementation side,
To avoid misuse of
GlobalContext::get<ConfigInclude>,I chose not using serde deserialization,
and instead did manual table extraction