Repository navigation
refactor(config): Pull out the ConfigStore into its own module - #17614
Conversation
|
r? @weihanglo rustbot has assigned @weihanglo. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
| Path, | ||
| /// A value defined in an environment variable. | ||
| #[expect(dead_code, reason = "file loading does not use environment values")] | ||
| Environment, |
There was a problem hiding this comment.
Do we have a plan of setting these two new DefintionKind elsewhere? Without a plan I am not sure what that would be.
There was a problem hiding this comment.
I added these solely because I re-framed this as a <enum>Kind which I felt made the API more cohesive / gave these a better name.
I am wondering about making Definition an opaque type with
fn kind(&self) -> DefinitionKindthough maybe that would be better namedfn precedence(&self) -> Precedence- a
Sourceenum which would beFile(Path) | Env(String) | None
There was a problem hiding this comment.
Making it opaque sounds fine to me.
a
Sourceenum which would beFile(Path) | Env(String) | None
Better! But still not extremely satisfied. Like our Source for dependencies is the actual source of the dependency, where this is like early mentioned a sticky-bit enum tracking the first loaded source. Our precedent of this is FeaturesFor (which is a bad name unfortunately).
If we cannot come up with a better one, I am good with Source.
In working to move `ConfigStore` out, I realized I had left behind the `config.rs` name instead of naming it `config_values.rs`. In preparing that, I realized I should have used a more distinct name rather than being one letter off from `ConfigValue`. My main aim for the name is to convey that this is not the actual config (that is deserialized) but the raw data.
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Update cargo submodule 11 commits in 15be64aa0859b5c36f7a86d52f7aa0db44ba4d84..cad07cf8e597397fff5d0f6cb79c9f870c0b1dd2 2026-10-20 16:03:21 +0000 to 2026-10-23 22:04:58 +0000 - build-rs: rename `cargo_target_family` to `cargo_cfg_target_family` (rust-lang/cargo#17636) - chore: replace `cfg(any())` with `cfg(false)` (rust-lang/cargo#17633) - feat(timings): peak memory as a column in unit table (rust-lang/cargo#17631) - Change `build_rs::input::cargo_cfg_target_env` to return `Option` (rust-lang/cargo#17632) - Update gix to 0.90.0 and adapt Git error recovery (rust-lang/cargo#17578) - Fix unused dep annotation (rust-lang/cargo#17625) - fix!: stop uplifting rlibs on nightly (rust-lang/cargo#17621) - refactor(config): Pull out the ConfigStore into its own module (rust-lang/cargo#17614) - test: simplify file content assertions (rust-lang/cargo#17617) - perf(context): Don't initialize windows-specific code on all platforms (rust-lang/cargo#17615) - refactor(context): Remove RLS-specific function (rust-lang/cargo#17616)
Update cargo submodule 11 commits in 15be64aa0859b5c36f7a86d52f7aa0db44ba4d84..cad07cf8e597397fff5d0f6cb79c9f870c0b1dd2 2026-10-20 16:03:21 +0000 to 2026-10-23 22:04:58 +0000 - build-rs: rename `cargo_target_family` to `cargo_cfg_target_family` (rust-lang/cargo#17636) - chore: replace `cfg(any())` with `cfg(false)` (rust-lang/cargo#17633) - feat(timings): peak memory as a column in unit table (rust-lang/cargo#17631) - Change `build_rs::input::cargo_cfg_target_env` to return `Option` (rust-lang/cargo#17632) - Update gix to 0.90.0 and adapt Git error recovery (rust-lang/cargo#17578) - Fix unused dep annotation (rust-lang/cargo#17625) - fix!: stop uplifting rlibs on nightly (rust-lang/cargo#17621) - refactor(config): Pull out the ConfigStore into its own module (rust-lang/cargo#17614) - test: simplify file content assertions (rust-lang/cargo#17617) - perf(context): Don't initialize windows-specific code on all platforms (rust-lang/cargo#17615) - refactor(context): Remove RLS-specific function (rust-lang/cargo#17616)
…g#17699) ### What does this PR try to resolve? This is part of rust-lang#12883. This builds on rust-lang#17614 and is prep for pulling the schemas into the config layer. We can then move all of this out into its own crate as there will be enough meat to it to justify it. None of these are in the critical path though and can be done over time. ### Notes to reviewers Github might not handle the code moves well but viewing locally in git will show that the moves involve minimal changes. This is not meant to be a complete picture for anything. For example, - `ConfigReader` should move from public fields to methods to build up state - We'll need to eventually move this off of `anyhow` - Ideally we decouple from `Shell` I had originally considered abstracting Env through a trait but figured it is close enough to how config works to move it there. We can always evaluate a trait later. --- 🤖 LLM involvement: analysis, prototyping, trivial code transformations
### What does this PR try to resolve? This is a lot of the API polish that was deferred out of rust-lang#17705. ### Notes to reviewers I was looking at the docs generated by `cargo doc` to help with the polishing. Still missing from the API - Changing the error type - Dropping `cargo-util-terminal` as a dep - Cleaning up `Definition` (see rust-lang#17614 (comment)) - Config discovery and include handling Still missing generally - More schema work Future refactors: - Switch from `toml_edit` to `toml_parser` for detecting extra syntax being used --- 🤖 LLM involvement: planning, prototyping, and moving code
What does this PR try to resolve?
This is part of #12883
By pulling out the raw ConfigStore API into its own module, we get a clearer picture of cross-module boundaries for what will eventually be cross-package boundaries.
The next step is to pull out deserialization. Once that is done, there is enough value to pull this all out into a separate package.
Notes to reviewers
🤖 LLM involvement: for trivial refactor steps