You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: support array of any types in Cargo config (#16103)
### What does this PR try to resolve?
This adds the support of array of any types in Cargo config.
The motivation of this is mostly from the proposed `-Zconfig-include`
syntax
(<#7723 (comment)>)
```toml
[[include]]
path = "a.toml"
optional = true
[[include]]
path = "b.toml"
optional = false
```
which before this Cargo only supported array of string.
Some design decisions:
* **Insta-stabilization**: This is insta- stabilizing a extension of
Cargo config. See
<#16103 (comment)>
* **No `CARGO_*` env support added** — Only the `--config` CLI and
file-based configuration start supporting array of any types. `CARGO_*`
config environment still doesn't. The only type you can set through
environment variable are still primitive types. For advanced env usage,
we left it as follow-up to deal with in `-Zadvanced-env`
* **Nothing changed in config merging rule** — Nested complex types in
array won't merge with any other items, as it still respects the current
array merging rule, which appends items.
* `cargo config get` now prints inline array/tables for array of nested
array/tables.
fixes#16111
### How to test and review this PR?
Starting from the fifth commit, those changes are for handling
diagnostic regression, as now `Config::from_toml` accepts any types and
the invalid type error is delayed from the "TOML->ConfigValue"
deserialization to "ConfigValue->Target" Type deserialization. Not sure
if we should split it to a separate PR, but the solution here I admit is
a bit nasty.
0 commit comments