rustfmt is using Josh to perform subtree synces with the rust-lang/rust repository.
The josh-sync tool is used as a wrapper on top of Josh to help automate the subtree
sync process (both pulls and pushes). You can install it with cargo install --git https://github.com/rust-lang/josh-sync.
- Be in a
rustfmtcheckout - Checkout the latest
mainbranch from upstream - Create a new branch that will be used for the sync
- Run
rustc-josh-sync pull - Confirm the creation of a PR directly by
rustc-josh-sync, or create a PR torust-lang/rustfmtrepository
Caution
For now, do not use the --allow-noop option of rustc-josh-sync. See
https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/Nightly.20sync.20mode.20of.20josh-sync.20issue/with/633238190.
The rustfmt maintainers will run Diff Check against the PR to catch any unexpected formatting changes.
- Maintainers should trigger Diff-Check for the combinations of Edition {2021, 2024} x Style Edition {2021, 2024}.
Once Diff Check failures are investigated and are resolved, the PR can then be merged.
Where applicable, we may need to update the CHANGELOG entries with merged PRs (both in rustfmt
repository and also in the rust-lang/rust rustfmt subtree that was included in the subtree-push
merge), and then bump rustfmt version number.
- Be in a
rustfmtcheckout - Checkout the latest
mainbranch from upstream - Run
rustc-josh-sync push <branch-name> <github-username>- Josh will push the changes to a branch with the given name in your
<github-username>/rustfork ofrust-lang/rust.
- Josh will push the changes to a branch with the given name in your
- Follow the prompt of
rustc-josh-syncto open a PR torust-lang/rust, or create the PR manually.
Make sure to minimize the time between a pull and a subsequent push to avoid unnecessary complications.