3
3
Clippy currently gets built with a pinned nightly version.
4
4
5
5
In the ` rust-lang/rust ` repository, where rustc resides, there's a copy of
6
- Clippy that compiler hackers modify from time to time to adapt to changes in the
6
+ Clippy that compiler devs modify from time to time to adapt to changes in the
7
7
unstable API of the compiler.
8
8
9
9
We need to sync these changes back to this repository periodically, and the
@@ -15,94 +15,81 @@ done in a bi-weekly basis if there's no urgent changes. This is done starting on
15
15
the day of the Rust stable release and then every other week. That way we
16
16
guarantee that we keep this repo up to date with the latest compiler API, and
17
17
every feature in Clippy is available for 2 weeks in nightly, before it can get
18
- to beta. For reference, the first sync following this cadence was performed the
18
+ to beta. For reference, the first sync following this cadence was performed on
19
19
2020-08-27.
20
20
21
- This process is described in detail in the following sections. For general
22
- information about ` subtree ` s in the Rust repository see [ the rustc-dev-guide] [ subtree ] .
21
+ This process is described in detail in the following sections.
23
22
24
- [ subtree ] : https://rustc-dev-guide.rust-lang.org/external-repos.html#external-dependencies-subtree
23
+ ## Installing ` josh-proxy `
25
24
26
- ## Patching git-subtree to work with big repos
25
+ The sync is done with [ JOSH] and fully scripted with ` cargo dev sync ` . The only
26
+ requirement is to install the ` josh-proxy ` binary from GitHub
27
27
28
- Currently, there's a bug in ` git-subtree ` that prevents it from working properly
29
- with the [ ` rust-lang/rust ` ] repo. There's an open PR to fix that, but it's
30
- stale. Before continuing with the following steps, we need to manually apply
31
- that fix to our local copy of ` git-subtree ` .
28
+ <!-- FIXME: Change to a release version once >r23.12.04 is released -->
32
29
33
- You can get the patched version of ` git-subtree ` from [ here] [ gitgitgadget-pr ] .
34
- Put this file under ` /usr/lib/git-core ` (making a backup of the previous file)
35
- and make sure it has the proper permissions:
36
-
37
- ``` bash
38
- sudo cp --backup /path/to/patched/git-subtree.sh /usr/lib/git-core/git-subtree
39
- sudo chmod --reference=/usr/lib/git-core/git-subtree~ /usr/lib/git-core/git-subtree
40
- sudo chown --reference=/usr/lib/git-core/git-subtree~ /usr/lib/git-core/git-subtree
30
+ ``` sh
31
+ $ RUSTFLAGS=" --cap-lints warn" cargo +stable install josh-proxy --git https://github.com/josh-project/josh
41
32
```
42
33
43
- > _ Note:_ The first time running ` git subtree push ` a cache has to be built.
44
- > This involves going through the complete Clippy history once. For this you
45
- > have to increase the stack limit though, which you can do with `ulimit -s
46
- > 60000` . Make sure to run the ` ulimit` command from the same session you call
47
- > git subtree.
34
+ [ JOSH ] : https://josh-project.github.io/josh/
35
+
36
+ ## Performing the sync from [ ` rust-lang/rust ` ] to Clippy
48
37
49
- > _ Note:_ If you are a Debian user, ` dash ` is the shell used by default for
50
- > scripts instead of ` sh ` . This shell has a hardcoded recursion limit set to
51
- > 1,000. In order to make this process work, you need to force the script to run
52
- > ` bash ` instead. You can do this by editing the first line of the ` git-subtree `
53
- > script and changing ` sh ` to ` bash ` .
38
+ Doing the sync now is just running
54
39
55
- > Note: The following sections assume that you have set up remotes following the
56
- > instructions in [ defining remotes] .
40
+ ```
41
+ $ cargo dev sync pull
42
+ ```
57
43
58
- [ gitgitgadget-pr ] : https://github.com/gitgitgadget/git/pull/493
59
- [ defining remotes ] : release.md#defining-remotes
44
+ This command will update the nightly toolchain in the ` rust-toolchain ` file and
45
+ will pull the changes from the Rust repository.
60
46
61
- ## Performing the sync from [ ` rust-lang/rust ` ] to Clippy
47
+ If there should be merge conflicts, resolve them now and commit with the message
48
+ ` Merge from rustc ` .[ ^ 1 ]
62
49
63
- Here is a TL;DR version of the sync process (all the following commands have
64
- to be run inside the ` rust ` directory):
65
-
66
- 1 . Clone the [ ` rust-lang/rust ` ] repository or make sure it is up-to-date.
67
- 2 . Checkout the commit from the latest available nightly. You can get it using
68
- ` rustup check ` .
69
- 3 . Sync the changes to the rust-copy of Clippy to your Clippy fork:
70
- ``` bash
71
- # Be sure to either use a net-new branch, e.g. `rustup`, or delete the branch beforehand
72
- # because changes cannot be fast forwarded and you have to run this command again.
73
- git subtree push -P src/tools/clippy clippy-local rustup
74
- ```
75
-
76
- > _Note:_ Most of the time you have to create a merge commit in the
77
- > ` rust-clippy` repo (this has to be done in the Clippy repo, not in the
78
- > rust-copy of Clippy):
79
- ` ` ` bash
80
- git fetch upstream # assuming upstream is the rust-lang/rust remote
81
- git switch rustup
82
- git merge upstream/master --no-ff
83
- ` ` `
84
- > Note: This is one of the few instances where a merge commit is allowed in
85
- > a PR.
86
- 4. Bump the nightly version in the Clippy repository by running these commands:
87
- ` ` ` bash
88
- cargo dev sync update_nightly
89
- git commit -m " Bump nightly version -> YYYY-MM-DD" rust-toolchain.toml clippy_utils/README.md
90
- ` ` `
91
- 5. Open a PR to ` rust-lang/rust-clippy` and wait for it to get merged (to
92
- accelerate the process ping the ` @rust-lang/clippy` team in your PR and/or
93
- ask them in the [Zulip] stream.)
50
+ > Note: If the version tests fail, refer to [ bump version] in the release
51
+ > documentation.
94
52
53
+ Open a PR to ` rust-lang/rust-clippy ` and if you are a Clippy maintainer, you can
54
+ ` r+ ` the PR yourself. If not, change ` r? @ghost ` to ` r? clippy ` and a Clippy
55
+ maintainer will get assigned. To accelerate the process ping the Clippy team on
56
+ [ Zulip] .
57
+
58
+
59
+ [ bump version ] : release.md#bump-version
95
60
[ Zulip ] : https://rust-lang.zulipchat.com/#narrow/stream/clippy
96
- [` rust-lang/rust` ]: https://github.com/rust-lang/rust
61
+
62
+ [ ^ 1 ] : The message is not really important, but consistency is nice.
97
63
98
64
## Performing the sync from Clippy to [ ` rust-lang/rust ` ]
99
65
100
- All the following commands have to be run inside the ` rust` directory.
66
+ The other direction is done by running
67
+
68
+ ```
69
+ $ cargo dev sync push /path/to/rust --user <GitHub-name>
70
+ ```
71
+
72
+ Where the ` /path/to/rust ` is a relative path to a Rust clone and the
73
+ ` <GitHub-name> ` is your GitHub user name. This is required for pushing the sync
74
+ to GitHub and opening a PR.
75
+
76
+ If everything went right, there will be a GitHub link that has to be used to
77
+ open the sync PR in the Rust repository. The PR description must look like this:
78
+
79
+ ```
80
+ Clippy subtree update
81
+
82
+ r? @ghost
101
83
102
- 1. Make sure you have checked out the latest ` master` of ` rust-lang/rust` .
103
- 2. Sync the ` rust-lang/rust-clippy` master to the rust-copy of Clippy:
104
- ` ` ` bash
105
- git switch -c clippy-subtree-update
106
- git subtree pull -P src/tools/clippy clippy-upstream master
107
- ` ` `
108
- 3. Open a PR to [` rust-lang/rust` ]
84
+ Sync from Clippy commit: rust-lang/rust-clippy@<sha1>
85
+ ```
86
+
87
+ The title must be kept as is, to [ tell triagebot] that this is a sync PR.
88
+
89
+ The second line must be kept as is, to [ find the Clippy commit] during a
90
+ release.
91
+
92
+ [ find the Clippy commit ] : release.md#find-the-clippy-commit
93
+ [ tell triagebot ] : https://github.com/rust-lang/rust/pull/114157
94
+
95
+ [ `rust-lang/rust` ] : https://github.com/rust-lang/rust
0 commit comments