Skip to content

chore: Flatten src#17231

Merged
weihanglo merged 15 commits into
rust-lang:masterfrom
epage:reorg
Jul 17, 2026
Merged

chore: Flatten src#17231
weihanglo merged 15 commits into
rust-lang:masterfrom
epage:reorg

Conversation

@epage

@epage epage commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

What does this PR try to resolve?

This is a follow up to #17230 which flattened src/cargo into src/. Now we're flattening and re-arranging within what is left, including:

  • src/ops more consistently have a cargo_ prefix (always trips me up guessing which way a file is)
  • src/core/resolver -> src/resolver
  • src/core/compiler -> src/compiler
  • src/core -> src/workspace
  • src/util/toml -> src/workspace/parser
  • src/util/toml_mut -> src/workspace/editor
  • src/util/context -> src/context
    • I already had to adjust imports to make the move cleaner, so I went ahead and shuffled those items around

Things not done

  • Finding a proper home for src/workspace/{gc,global_cache_tracker,shell}.rs
  • Finer re-arrangements within any of these, particularly src/compiler, requires deeper inspection
  • Splitting a config out of context, may require deeper refactors

How to test and review this PR?

See zulip thread: #t-cargo > Re-organizing the Cargo repo

@rustbot

rustbot commented Jul 17, 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: @epage, @weihanglo
  • @epage, @weihanglo expanded to epage, weihanglo

@rustbot rustbot added A-cache-messages Area: caching of compiler messages A-cargo-targets Area: selection and definition of targets (lib, bins, examples, tests, benches) A-cli Area: Command-line interface, option parsing, etc. A-console-output Area: Terminal output, colors, progress bar, etc. A-dependency-resolution Area: dependency resolution and the resolver A-directory-source Area: directory sources (vendoring) A-documenting-cargo-itself Area: Cargo's documentation A-git Area: anything dealing with git A-interacts-with-crates.io Area: interaction with registries A-json-output Area: JSON message output A-local-registry-source Area: local registry sources (vendoring) A-lockfile Area: Cargo.lock issues A-networking Area: networking issues, curl, etc. A-overrides Area: general issues with overriding dependencies (patch, replace, paths) A-registries Area: registries A-registry-authentication Area: registry authentication and authorization (authn authz) A-source-replacement Area: [source] replacement A-sparse-registry Area: http sparse registries A-testing-cargo-itself Area: cargo's tests A-workspaces Area: workspaces labels Jul 17, 2026
@rustbot rustbot added Command-update S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 17, 2026
@rustbot rustbot added the A-infrastructure Area: infrastructure around the cargo repo, ci, releases, etc. label Jul 17, 2026
@epage
epage force-pushed the reorg branch 2 times, most recently from 771f07a to d1f1bc4 Compare July 17, 2026 19:29

@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.

Other than workspace everything looks awesome.

I got a feeling that workspace module becomes the new core.

View changes since this review

Comment thread doc/book/src/CHANGELOG.md
[#11620](https://github.com/rust-lang/cargo/pull/11620)
- Mention current default value in `publish.timeout` docs.
[#11652](https://github.com/rust-lang/cargo/pull/11652)
- More doc comments for `cargo::core::compiler` modules.

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 really need to update changelog?

(Fine with that to be honest)

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.

Oops, blindly opened files for edit. Fixed locally. Waiting for any CI failures before pushing

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 am less sure about core -> worskpace, especial like this src/workspace/workspace.rs. Anyway, we can deal with them later, as the blast radius will shrink.

Comment thread src/util/toml/embedded.rs Outdated

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.

Same. Not satisfied with workspace (better than the current one though).

@weihanglo
weihanglo enabled auto-merge July 17, 2026 19:56
@weihanglo
weihanglo added this pull request to the merge queue Jul 17, 2026
Merged via the queue into rust-lang:master with commit 1ff80b4 Jul 17, 2026
29 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 17, 2026
@epage
epage deleted the reorg branch July 17, 2026 21:02
pull Bot pushed a commit to weiyilai/cargo that referenced this pull request Jul 18, 2026
…-lang#17233)

### What does this PR try to resolve?

Noticed this discrepancy towards the end of rust-lang#17231 but didn't seem worth
holding that up more as this won't cause many conflicts

### How to test and review this PR?
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Jul 18, 2026
Update cargo submodule

29 commits in 59800466c5c41c444d264b1010b4d57e85a7117f..3efb1f477e99b42974b982d939fd100303cdf7db
2026-07-07 15:52:22 +0000 to 2026-07-17 23:53:19 +0000
- refactor(context): normalize in `homedir` instead (rust-lang/cargo#17222)
- chore(ci): reflect doc folder move in book deployment (rust-lang/cargo#17235)
- refactor(ops): Have cargo-metadata's ops match the command name (rust-lang/cargo#17233)
- chore: Flatten src (rust-lang/cargo#17231)
- chore: Flatten `src` (rust-lang/cargo#17230)
- chore(ci): remove stale libsecret packages (rust-lang/cargo#17229)
- perf: Lazily initialize git2 fetch transports  (rust-lang/cargo#17226)
- test(trim-paths): re-enable lldb debugger tests  (rust-lang/cargo#17223)
- Include SBOM outputs in fingerprints (rust-lang/cargo#17216)
- Update cfg_aliases to 0.2.2 (rust-lang/cargo#17225)
- test(trim-paths): exercise GDB on windows-gnu (rust-lang/cargo#17221)
- feat(profile): Disable incremental compilation under CI by default (rust-lang/cargo#17220)
- Remove myself from review rotation (rust-lang/cargo#17219)
- Fix typo in comment in sync (rust-lang/cargo#17217)
- docs(ref): Improve handing of built-in profiles (rust-lang/cargo#17213)
- fix: dont apply host-config gating to stable behavior (rust-lang/cargo#17198)
- chore(deps): update msrv (rust-lang/cargo#17192)
- test: fix race in cargo_compile_with_invalid_code_in_deps (rust-lang/cargo#17203)
- Rename `-Zno-embed-metadata` to `-Zembed-metadata=no` (rust-lang/cargo#17149)
- fix(source): incorrect duplicate package warning (rust-lang/cargo#17204)
- Fix manifest schema generation: `TomlDebugInfo` enum-variants doesn't renamed (rust-lang/cargo#17202)
- Reduce library search path length in new build dir layout (rust-lang/cargo#17191)
- fix(install): Move --debug to Compilation options (rust-lang/cargo#17199)
- chore(ci): dogfood `build.warnings` (rust-lang/cargo#17195)
- docs(lints): Better match clippy in lint section titles (rust-lang/cargo#17190)
- chore: bump to 0.100.0; update changelog (rust-lang/cargo#17189)
- docs(ref): Clarify MSRV for lints (rust-lang/cargo#17184)
- docs(report): add missing entry for `cargo report future-incompatibilities` (rust-lang/cargo#17188)
- Reduce rustc `-L` args used in the new `build-dir` layout (rust-lang/cargo#17168)
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Jul 18, 2026
Update cargo submodule

29 commits in 59800466c5c41c444d264b1010b4d57e85a7117f..3efb1f477e99b42974b982d939fd100303cdf7db
2026-07-07 15:52:22 +0000 to 2026-07-17 23:53:19 +0000
- refactor(context): normalize in `homedir` instead (rust-lang/cargo#17222)
- chore(ci): reflect doc folder move in book deployment (rust-lang/cargo#17235)
- refactor(ops): Have cargo-metadata's ops match the command name (rust-lang/cargo#17233)
- chore: Flatten src (rust-lang/cargo#17231)
- chore: Flatten `src` (rust-lang/cargo#17230)
- chore(ci): remove stale libsecret packages (rust-lang/cargo#17229)
- perf: Lazily initialize git2 fetch transports  (rust-lang/cargo#17226)
- test(trim-paths): re-enable lldb debugger tests  (rust-lang/cargo#17223)
- Include SBOM outputs in fingerprints (rust-lang/cargo#17216)
- Update cfg_aliases to 0.2.2 (rust-lang/cargo#17225)
- test(trim-paths): exercise GDB on windows-gnu (rust-lang/cargo#17221)
- feat(profile): Disable incremental compilation under CI by default (rust-lang/cargo#17220)
- Remove myself from review rotation (rust-lang/cargo#17219)
- Fix typo in comment in sync (rust-lang/cargo#17217)
- docs(ref): Improve handing of built-in profiles (rust-lang/cargo#17213)
- fix: dont apply host-config gating to stable behavior (rust-lang/cargo#17198)
- chore(deps): update msrv (rust-lang/cargo#17192)
- test: fix race in cargo_compile_with_invalid_code_in_deps (rust-lang/cargo#17203)
- Rename `-Zno-embed-metadata` to `-Zembed-metadata=no` (rust-lang/cargo#17149)
- fix(source): incorrect duplicate package warning (rust-lang/cargo#17204)
- Fix manifest schema generation: `TomlDebugInfo` enum-variants doesn't renamed (rust-lang/cargo#17202)
- Reduce library search path length in new build dir layout (rust-lang/cargo#17191)
- fix(install): Move --debug to Compilation options (rust-lang/cargo#17199)
- chore(ci): dogfood `build.warnings` (rust-lang/cargo#17195)
- docs(lints): Better match clippy in lint section titles (rust-lang/cargo#17190)
- chore: bump to 0.100.0; update changelog (rust-lang/cargo#17189)
- docs(ref): Clarify MSRV for lints (rust-lang/cargo#17184)
- docs(report): add missing entry for `cargo report future-incompatibilities` (rust-lang/cargo#17188)
- Reduce rustc `-L` args used in the new `build-dir` layout (rust-lang/cargo#17168)
@rustbot rustbot added this to the 1.99.0 milestone Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cache-messages Area: caching of compiler messages A-cargo-targets Area: selection and definition of targets (lib, bins, examples, tests, benches) A-cli Area: Command-line interface, option parsing, etc. A-console-output Area: Terminal output, colors, progress bar, etc. A-dependency-resolution Area: dependency resolution and the resolver A-directory-source Area: directory sources (vendoring) A-documenting-cargo-itself Area: Cargo's documentation 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-json-output Area: JSON message output A-local-registry-source Area: local registry sources (vendoring) A-lockfile Area: Cargo.lock issues A-networking Area: networking issues, curl, etc. A-overrides Area: general issues with overriding dependencies (patch, replace, paths) A-registries Area: registries A-registry-authentication Area: registry authentication and authorization (authn authz) A-source-replacement Area: [source] replacement A-sparse-registry Area: http sparse registries A-testing-cargo-itself Area: cargo's tests A-workspaces Area: workspaces Command-add Command-clean Command-doc Command-fetch Command-fix Command-install Command-locate-project Command-metadata Command-new Command-package Command-pkgid Command-read-manifest Command-remove Command-report Command-run Command-test Command-tree Command-uninstall Command-update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants