This is an issue tracking how many issue we encountered because Cargo is not a Git subtree in rust-lang/rust repository. See also the discussion in #t-cargo > Turning cargo into a subtree.
Below is a summary from t-cargo originally posted in #t-cargo > Turning cargo into a subtree @ 💬.
The Cargo team has discussed subtree migration last week. We've got a couple of questions and would like to understand before proceeding:
- Motiviation of turning into a subtree.
- Burden of resolving conflicts
- Issue / PR managements
- Possibility to revert to submodule
Motivation of turning into a subtree
It seems that it was brought up again because there were some recent pull requests blocked by Cargo's overly-fitted test assertions. Apart from that, are there any other reasons or benefits people wanting Cargo to be a subtree? How painful is it that people need it to happen soon otherwise it toils the development?
From 1.75 (2023-12-28) to 1.83 (as of 2025-01-07), there are around 11 pull requests opened in rust-lang/cargo because test failures in Cargo's test suite really blocked their pull request in rust-lang/rust.
See a list of pull requests
There are other cross-repo efforts like check-cfg and checksum-freshness. However I don't think it is better do it in subtree, as those changes are way larger and may require scrutiny from the Cargo team. See the full list of PRs in the end of this post
It generally doesn't seem like its being too much a burden for the current submodule process. To myself I have been actively helping people to unblock Cargo and never feel stressful about it. We would like to understand how other teams' feelings. Maybe it is really frustrating to other? Maybe they just didn't know who to ask for helps?
Burden of resolving conflicts
According to feedback from miri and other repos, conflicts seem rare and easy to deal with. The current Cargo maintainer doing sync (me) is also willing to take resposibility to do subtree maintenance as well. However, team still has concerns of the burden.
I've collected data from other subtree projects of how often they synced back to the original repositories:
- miri
- rust-analyzer
- rust-clippy
- From 2024-01-25 to 2025-01-08
- 20 manual syncs
git log --format='%h %an: %s' --since 2024-01-07 -- rust-toolchain | rg clippy-subtree-update
- rustfmt
- From 2024-06-12 to 2025-01-08: 2 manual syncs
git log --format='%h %an: %s' --since 2024-01-07 -- rust-toolchain
The number of subtree-to-repo syncs are not really as many as I expect. Apparently Miri outnumbered others, though those PRs are mostly one-click-mergeable.
However, rust-lang/cargo has weird CI — it needs to pass all stable, beta, and nightly channel. A change in subtreee may accidentally fail on stable or beta. What if we discovered it only after beta cutoff, should we backport the fix of conflits?
Also, if a subtree-to-repo sync happens after beta cutoff, that sync needs to merge into beta branch (rust-1.y.z branch ) in rust-lang/cargo. That means cargo might not be able to reuse scripts from existing subtree, or need more tweaks. The CI infra migration possibly requires more works than the recent rustc-dev-guide one.
Issue / PR managements
These are not really big problems but a compilation of small questions about the project management.
- Will GitHub magic keywords close issues with the same number for both repos? For example, in cargo a commit message says
closes #12345. Will it also close rust-lang/rust#12345 when syncing to subtree?
- Similarly, the commit hash changes between repos for the same commit. Which one commit should be the de facto one when discussing/linking/sharing? The question can be seen as "which one is the real source." or "don't duplicate source code" which @Josh Triplett has called out one year ago.
- If a pull request was opened in rust-lang/rust but has nothing to do with compiler, should we merge it then, or request a reopen in rust-lang/cargo? What is the general rule of the current subtrees?
- Should PR to cargo subtree require approvals from the Cargo team? That requires a more granular bors permission though, and we've seen some objections to that because people may want to get a faster merge for small changes without waiting for specific teams/people.
Possibility to revert to submodule
If it turns out not suitable for Cargo's workflow, is it possible to revert back to Git submodule, and how would it be?
If reverting is easier, it is more likely we could test out and see if it is worth it.
Anyhow, the cargo team is more on weighing the benefit and tradeoff. Dont take these questions as objection :)
See the full list of cross-repo PR in rust-lang/cargo
Note: not all of them really need to happen in subtree.
- 1.85.0
- 1.84.0
- 1.83.0
- 1.82.0
- 1.81.0
- 1.80.0
- 1.79.0
- 1.78.0
- 1.77.0
- 1.76.0
- 1.75.0
Summary Notes
Managed by @rustbot—see help for details
This is an issue tracking how many issue we encountered because Cargo is not a Git subtree in rust-lang/rust repository. See also the discussion in #t-cargo > Turning cargo into a subtree.
Below is a summary from t-cargo originally posted in #t-cargo > Turning cargo into a subtree @ 💬.
The Cargo team has discussed subtree migration last week. We've got a couple of questions and would like to understand before proceeding:
Motivation of turning into a subtree
It seems that it was brought up again because there were some recent pull requests blocked by Cargo's overly-fitted test assertions. Apart from that, are there any other reasons or benefits people wanting Cargo to be a subtree? How painful is it that people need it to happen soon otherwise it toils the development?
From 1.75 (2023-12-28) to 1.83 (as of 2025-01-07), there are around 11 pull requests opened in rust-lang/cargo because test failures in Cargo's test suite really blocked their pull request in rust-lang/rust.
See a list of pull requests
bad_crate_typeto only match error message prefix #14990testcfg as a well known cfg before of compiler change #14963rustcwording changes #14341rustcwording changes #14135droptolet _due to nightly rustc change #13964-Zpanic-abort-teststo doctests too #13388fix_exec_rustc#12951It generally doesn't seem like its being too much a burden for the current submodule process. To myself I have been actively helping people to unblock Cargo and never feel stressful about it. We would like to understand how other teams' feelings. Maybe it is really frustrating to other? Maybe they just didn't know who to ask for helps?
Burden of resolving conflicts
According to feedback from miri and other repos, conflicts seem rare and easy to deal with. The current Cargo maintainer doing sync (me) is also willing to take resposibility to do subtree maintenance as well. However, team still has concerns of the burden.
I've collected data from other subtree projects of how often they synced back to the original repositories:
git log --format='%h %an: %s' --since 2024-01-07 -- rust-versiongit log --format='%h %an: %s' --since 2024-01-07 -- rust-versiongit log --format='%h %an: %s' --since 2024-01-07 -- rust-toolchain | rg clippy-subtree-updategit log --format='%h %an: %s' --since 2024-01-07 -- rust-toolchainThe number of subtree-to-repo syncs are not really as many as I expect. Apparently Miri outnumbered others, though those PRs are mostly one-click-mergeable.
However, rust-lang/cargo has weird CI — it needs to pass all stable, beta, and nightly channel. A change in subtreee may accidentally fail on stable or beta. What if we discovered it only after beta cutoff, should we backport the fix of conflits?
Also, if a subtree-to-repo sync happens after beta cutoff, that sync needs to merge into beta branch (
rust-1.y.zbranch ) in rust-lang/cargo. That means cargo might not be able to reuse scripts from existing subtree, or need more tweaks. The CI infra migration possibly requires more works than the recent rustc-dev-guide one.Issue / PR managements
These are not really big problems but a compilation of small questions about the project management.
closes #12345. Will it also closerust-lang/rust#12345when syncing to subtree?Possibility to revert to submodule
If it turns out not suitable for Cargo's workflow, is it possible to revert back to Git submodule, and how would it be?
If reverting is easier, it is more likely we could test out and see if it is worth it.
Anyhow, the cargo team is more on weighing the benefit and tradeoff. Dont take these questions as objection :)
See the full list of cross-repo PR in rust-lang/cargo
bad_crate_typeto only match error message prefix #14990testcfg as a well known cfg before of compiler change #14963cargo_test_envto unblock rust submodule update #14803rustcwording changes #14341librarydir #14370rustcwording changes #14135-Zcheck-cfgas always enabled #13571droptolet _due to nightly rustc change #13964-vVinvocation #13659-Zpanic-abort-teststo doctests too #13388x86_64-unknown-none-gnu#13362rust-lang/rust'somit-git-hash#12968-Zcheck-cfgfor new rustc syntax and behavior #12845fix_exec_rustc#12951Summary Notes
Managed by
@rustbot—see help for details