Skip to content

refactor(config): Pull out the ConfigStore into its own module - #17614

Open
epage wants to merge 9 commits into
rust-lang:masterfrom
epage:config
Open

epage wants to merge 9 commits into
rust-lang:masterfrom
epage:config

Conversation

@epage

@epage epage commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

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

@rustbot rustbot added A-configuration Area: cargo config files and env vars S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 20, 2026
@rustbot

rustbot commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

r? @weihanglo

rustbot has assigned @weihanglo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @Muscraft, @epage, @weihanglo
  • @Muscraft, @epage, @weihanglo expanded to Muscraft, epage, weihanglo
  • Random selection from Muscraft, weihanglo

@rustbot

This comment has been minimized.

Comment thread src/config/definition.rs
Comment thread src/context/value.rs Outdated
Path,
/// A value defined in an environment variable.
#[expect(dead_code, reason = "file loading does not use environment values")]
Environment,

@weihanglo weihanglo Oct 20, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a plan of setting these two new DefintionKind elsewhere? Without a plan I am not sure what that would be.

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) -> DefinitionKind though maybe that would be better named fn precedence(&self) -> Precedence
  • a Source enum which would be File(Path) | Env(String) | None

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making it opaque sounds fine to me.

a Source enum which would be File(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.

Comment thread src/context/value.rs Outdated
epage added 9 commits October 20, 2026 19:20
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.
@rustbot

rustbot commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator

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.

This branch has not been deployed

No deployments
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 S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants