Skip to content

refactor(config)!: various polish - #17787

Merged
weihanglo merged 8 commits into
rust-lang:masterfrom
weihanglo:polish
Nov 23, 2026
Merged

weihanglo merged 8 commits into
rust-lang:masterfrom
weihanglo:polish

Conversation

@weihanglo

Copy link
Copy Markdown
Member

What does this PR try to resolve?

This polishes around ConfigLoader API, including

  • documentation clarification
  • API rename
  • doc-hide get_file_path which doesn't make sense

Notes to reviewers

Name bikeshedding welcome.

Upon this point I feel like the cwd field on ConfigLoader is weird. Haven't yet though hard on a better form.


🤖 LLM involvement: rebase and moving commits around.

@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 Nov 22, 2026
@rustbot

rustbot commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

r? @Muscraft

rustbot has assigned @Muscraft.
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, epage

@epage epage Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

non-blocker: if there are places within src/ that haven't had this applied, we probably should do that. I think this was confusing but just kept forgetting to fix it

View changes since the review

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Will have a follow-up.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Comment thread crates/cargo-util-config/src/loader.rs Outdated
Comment on lines +199 to +200
#[doc(hidden)]
pub fn _get_file_path(

@epage epage Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

will this cause cargo-semver-checks to ignore this, causing us to miss breaking changes?

View changes since the review

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

it will, though I was just wanting to bypass that ;)

Let's get it back to a normal public item then

Comment thread crates/cargo-util-config/src/loader.rs Outdated
}

/// Converts the `include` config value to a list of absolute paths.
/// Reads and validates the `include` entries of `config`.

@epage epage Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: feel like validate isn't needed to be called out

View changes since the review

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Removed

Comment thread crates/cargo-util-config/src/loader.rs Outdated
///
/// The `--config` value can be a path to a config file or a `key=value` pair.
/// Later arguments take precedence over earlier ones.
pub fn load_cli_args(&self, cli_args: &[String]) -> Result<ConfigStore> {

@epage epage Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

non-blocker: should we add _layer to this?

View changes since the review

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Applied.

@epage

epage commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Upon this point I feel like the cwd field on ConfigLoader is weird. Haven't yet though hard on a better form.

How so? We need to know the information and it communicates the expected policy. I would lean towards us renaming cwd to current_dir in cargo to be consistent with std.

@epage epage left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Feel free to merge when ready

View changes since this review

@rustbot

rustbot commented Nov 23, 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.

@weihanglo weihanglo left a comment •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Also updated most of the cwd -> current_dir in cargo-util-config

View changes since this review

Comment thread crates/cargo-util-config/src/loader.rs Outdated
}

/// Converts the `include` config value to a list of absolute paths.
/// Reads and validates the `include` entries of `config`.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Removed

Comment thread crates/cargo-util-config/src/loader.rs Outdated
Comment on lines +199 to +200
#[doc(hidden)]
pub fn _get_file_path(

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

it will, though I was just wanting to bypass that ;)

Let's get it back to a normal public item then

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Will have a follow-up.

Comment thread crates/cargo-util-config/src/loader.rs Outdated
///
/// The `--config` value can be a path to a config file or a `key=value` pair.
/// Later arguments take precedence over earlier ones.
pub fn load_cli_args(&self, cli_args: &[String]) -> Result<ConfigStore> {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Applied.

@weihanglo
weihanglo enabled auto-merge November 23, 2026 15:55
@weihanglo
weihanglo added this pull request to the merge queue Nov 23, 2026
Merged via the queue into rust-lang:master with commit 9a9a82b Nov 23, 2026
30 checks passed
@weihanglo
weihanglo deleted the polish branch November 23, 2026 17:02
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 23, 2026
weihanglo pushed a commit to weihanglo/cargo that referenced this pull request Nov 23, 2026
### What does this PR try to resolve?

Follow up
rust-lang#17787 (comment)

### Notes to reviewers

---

🤖 LLM involvement: guided refactor
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Nov 28, 2026
Update cargo submodule

14 commits in ae8f06eb41b8c4a534d0f280f1b9d287f45ead73..39eba940bf913a566c4763c836cbe24b9f975200
2026-11-21 04:06:35 +0000 to 2026-11-27 22:28:03 +0000
- feat(config)!: Delegate `Definition` origin to `Origin` and precedence to `Scope` (rust-lang/cargo#17822)
- Reduce the usage of `sleep_ms()` in testsuite (rust-lang/cargo#17819)
- fix(clean): Don't double count hardlinks when actually cleaning (rust-lang/cargo#17805)
- Reduce the usage of `sleep_ms()` in freshness tests (rust-lang/cargo#17816)
- fix(git): run gc in foreground to avoid race (rust-lang/cargo#17818)
- fix(script): Skip a UTF-8 BOM before parsing the frontmatter (rust-lang/cargo#17806)
- Reduce the usage of `sleep_ms()` in testsuite (rust-lang/cargo#17815)
- fix(compile): Differentiate levels of debug info  (rust-lang/cargo#17798)
- fix(profiles): line-tables-only on nightly only (rust-lang/cargo#17797)
- fix(cli): Suggest `--profile debug` on all commands that default to `dev` (rust-lang/cargo#17796)
- refactor: clarify home is cargo home (rust-lang/cargo#17790)
- refactor(config)!: various polish (rust-lang/cargo#17787)
- refactor(git): extract git backends to their own modules (rust-lang/cargo#17789)
- docs: fix typos in documentation (rust-lang/cargo#17783)

r? ghost
@rustbot rustbot added this to the 1.102.0 milestone Nov 28, 2026
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants