Skip to content

feat(config): Expose config merging, reading, and schemas in a crate - #17705

Merged
weihanglo merged 10 commits into
rust-lang:masterfrom
epage:config
Nov 10, 2026
Merged

weihanglo merged 10 commits into
rust-lang:masterfrom
epage:config

Conversation

@epage

@epage epage commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

What does this PR try to resolve?

This is part of #12883. This moves all but config file discovery to cargo-util-config.

Notes to reviewers

Next steps:

  • Define top-level schema types for JSON schema only
  • Generate JSON schemas
  • Clean up the API (prefer builders, avoid anyhow and cargo-util-terminal, documentation, etc)

🤖 LLM involvement: Prototyping and making individual code transformations steps along this path

@rustbot

rustbot commented Nov 9, 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, weihanglo

@rustbot rustbot added A-build-execution Area: anything dealing with executing the compiler A-build-scripts Area: build.rs scripts A-cache-messages Area: caching of compiler messages A-cargo-targets Area: selection and definition of targets (lib, bins, examples, tests, benches) A-cfg-expr Area: Platform cfg expressions A-cli Area: Command-line interface, option parsing, etc. A-configuration Area: cargo config files and env vars A-dep-info Area: dep-info, .d files A-dependency-resolution Area: dependency resolution and the resolver A-directory-source Area: directory sources (vendoring) A-features2 Area: issues specifically related to the v2 feature resolver A-future-incompat Area: future incompatible reporting A-git Area: anything dealing with git A-infrastructure Area: infrastructure around the cargo repo, ci, releases, etc. A-interacts-with-crates.io Area: interaction with registries A-layout Area: target output directory layout, naming, and organization A-links Area: `links` native library links setting A-lockfile Area: Cargo.lock issues A-lto Area: link-time optimization A-manifest Area: Cargo.toml issues A-networking Area: networking issues, curl, etc. A-profiles Area: profiles A-rebuild-detection Area: rebuild detection and fingerprinting A-registries Area: registries A-registry-authentication Area: registry authentication and authorization (authn authz) A-sparse-registry Area: http sparse registries A-timings Area: timings labels Nov 9, 2026
@rustbot

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

Choose a reason for hiding this comment

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

We've discussed this in today's cargo meeting, and are happy to move forward with a new crate. It is anyway a great refactor!

Things to do after merging this:

View changes since this review

@@ -1,11 +1,10 @@
use std::fs;
use std::path::{Path, PathBuf};

use anyhow::{Context as _, bail};
use anyhow::{Context as _, Result, bail};

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.

I wish we could have our own Result type for cargo-util-config. Anyway, this is a future work.

Comment thread Cargo.toml

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.

publish.py needs an update I guess.

TO_PUBLISH = [

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.

Updated

@weihanglo
weihanglo added this pull request to the merge queue Nov 10, 2026
Merged via the queue into rust-lang:master with commit 517bfa2 Nov 10, 2026
31 of 32 checks passed
@epage
epage deleted the config branch November 11, 2026 02:54
@epage

epage commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the reminder of the process.

I've requested the ownership transfer at #t-infra > Transfer `cargo-util-config` @ 💬.

rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Nov 11, 2026
Update cargo submodule

15 commits in c07ac2c4d12237effc4b94f4543769b421790045..ede6cefea9731cb595942338824c2f9a610b8189
2026-11-06 19:13:29 +0000 to 2026-11-11 12:33:16 +0000
- chore: bump to 0.103.0; update changelog (rust-lang/cargo#17709)
- Update documentation about adding new publishable crates (rust-lang/cargo#17711)
- test: Make cross compile test work with annotate-snippets whitespace changes (rust-lang/cargo#17707)
- feat(config): Expose config merging, reading, and schemas in a crate (rust-lang/cargo#17705)
- feat(schema): Expose SBOM types (rust-lang/cargo#17683)
- fix: strip host deps whose debuginfo was weakened already (rust-lang/cargo#17691)
- fix: dont strip if any transtive dep has debuginfo on  (rust-lang/cargo#17689)
- Reduce memory allocation in crate_type.rs (rust-lang/cargo#17706)
- fix(doc): do not suggest cargo fix for rustdoc warnings (rust-lang/cargo#17702)
- perf(parse): Trade remote manifest diagnostic quality for performance (rust-lang/cargo#17701)
- refactor(config): Pull deserialiation into the config layer (rust-lang/cargo#17699)
- Use trusted publishing for the home crate (rust-lang/cargo#17703)
- refactor(benchsuite): Port to divan (rust-lang/cargo#17700)
- fix(schema): Improve deserialization errors and performance (rust-lang/cargo#17697)
- fix(lockfile): sort unused patches in Cargo.lock (rust-lang/cargo#17698)
@rustbot rustbot added this to the 1.102.0 milestone Nov 12, 2026
Muscraft pushed a commit to Muscraft/cargo that referenced this pull request Nov 14, 2026
### 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-build-execution Area: anything dealing with executing the compiler A-build-scripts Area: build.rs scripts A-cache-messages Area: caching of compiler messages A-cargo-targets Area: selection and definition of targets (lib, bins, examples, tests, benches) A-cfg-expr Area: Platform cfg expressions A-cli Area: Command-line interface, option parsing, etc. A-configuration Area: cargo config files and env vars A-dep-info Area: dep-info, .d files A-dependency-resolution Area: dependency resolution and the resolver A-directory-source Area: directory sources (vendoring) A-features2 Area: issues specifically related to the v2 feature resolver A-future-incompat Area: future incompatible reporting A-git Area: anything dealing with git A-infrastructure Area: infrastructure around the cargo repo, ci, releases, etc. A-interacts-with-crates.io Area: interaction with registries A-layout Area: target output directory layout, naming, and organization A-links Area: `links` native library links setting A-lockfile Area: Cargo.lock issues A-lto Area: link-time optimization A-manifest Area: Cargo.toml issues A-networking Area: networking issues, curl, etc. A-profiles Area: profiles A-rebuild-detection Area: rebuild detection and fingerprinting A-registries Area: registries A-registry-authentication Area: registry authentication and authorization (authn authz) A-sparse-registry Area: http sparse registries A-timings Area: timings A-workspaces Area: workspaces Command-add Command-build Command-clean Command-fetch Command-fix Command-info Command-install Command-package Command-publish Command-report Command-rustc Command-test Command-tree Command-update Command-vendor Command-verify-project I-nominated-to-discuss To be discussed during issue triage on the next Cargo team meeting S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants