Skip to content

Commit 7579123

Browse files
committed
Auto merge of #6401 - ebroto:pin_to_a_nightly, r=<try>
📌 Pin Clippy to a nightly 📌 changelog: Pin Clippy to a specific nightly version (No more master/custom toolchain required to compile Clippy) Addresses partially #5561. As proposed there in [this comment](#5561 (comment)), this kicks off the process, to help us get acquainted with how the syncs should work, before working on improving the tooling. Open questions: * When performing a rustup, we will need to exclude the commits that were merged that same day, or else wait until that nightly is released. I did not update the documentation about this part, mainly because I'm not sure about how to do that. * When should we perform the rustups now? My first idea is to do it at the same time we do the clippyups, to have a clear cadence and to avoid the two copies of the repo to diverge enough to make the process painful. * Who does the rustups now? If we follow my previous idea and do both rustup and clippyup at the same time, it would be more work for `@flip1995` who currently does the clippyups. I would prefer to establish some kind of rotation to spead the work. Other ideas? * I'm not sure if this affects the release process in any way. * ??? `@rust-lang/clippy` thoughts? r? `@flip1995`
2 parents 6c70133 + 279721c commit 7579123

File tree

7 files changed

+59
-202
lines changed

7 files changed

+59
-202
lines changed

.github/workflows/clippy.yml

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -35,29 +35,12 @@ jobs:
3535
with:
3636
github_token: "${{ secrets.github_token }}"
3737

38-
- name: rust-toolchain
39-
uses: actions-rs/[email protected]
40-
with:
41-
toolchain: nightly
42-
target: x86_64-unknown-linux-gnu
43-
profile: minimal
44-
4538
- name: Checkout
4639
uses: actions/[email protected]
4740

48-
- name: Run cargo update
49-
run: cargo update
50-
51-
- name: Cache cargo dir
52-
uses: actions/cache@v2
53-
with:
54-
path: ~/.cargo
55-
key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('Cargo.lock') }}
56-
restore-keys: |
57-
${{ runner.os }}-x86_64-unknown-linux-gnu
58-
59-
- name: Master Toolchain Setup
60-
run: bash setup-toolchain.sh
41+
# HACK(flip1995): This is here to install the correct toolchain
42+
- name: Print cargo version
43+
run: cargo -V
6144

6245
# Run
6346
- name: Set LD_LIBRARY_PATH (Linux)
@@ -66,13 +49,13 @@ jobs:
6649
echo "LD_LIBRARY_PATH=${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}" >> $GITHUB_ENV
6750
6851
- name: Build
69-
run: cargo build --features deny-warnings
52+
run: cargo build --features deny-warnings,internal-lints
7053

7154
- name: Test
72-
run: cargo test --features deny-warnings
55+
run: cargo test --features deny-warnings,internal-lints
7356

7457
- name: Test clippy_lints
75-
run: cargo test --features deny-warnings
58+
run: cargo test --features deny-warnings,internal-lints
7659
working-directory: clippy_lints
7760

7861
- name: Test rustc_tools_util
@@ -98,9 +81,3 @@ jobs:
9881
cargo dev new_lint --name new_late_pass --pass late
9982
cargo check
10083
git reset --hard HEAD
101-
102-
# Cleanup
103-
- name: Run cargo-cache --autoclean
104-
run: |
105-
cargo +nightly install cargo-cache --no-default-features --features ci-autoclean cargo-cache
106-
cargo cache

.github/workflows/clippy_bors.yml

Lines changed: 15 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
2424
with:
2525
github_token: "${{ secrets.github_token }}"
26+
2627
- name: Checkout
2728
uses: actions/[email protected]
2829
with:
@@ -84,31 +85,12 @@ jobs:
8485
sudo apt-get install gcc-multilib libssl-dev:i386 libgit2-dev:i386
8586
if: matrix.host == 'i686-unknown-linux-gnu'
8687

87-
- name: rust-toolchain
88-
uses: actions-rs/[email protected]
89-
with:
90-
toolchain: nightly
91-
target: ${{ matrix.host }}
92-
profile: minimal
93-
9488
- name: Checkout
9589
uses: actions/[email protected]
9690

97-
- name: Run cargo update
98-
run: cargo update
99-
100-
- name: Cache cargo dir
101-
uses: actions/cache@v2
102-
with:
103-
path: ~/.cargo
104-
key: ${{ runner.os }}-${{ matrix.host }}-${{ hashFiles('Cargo.lock') }}
105-
restore-keys: |
106-
${{ runner.os }}-${{ matrix.host }}
107-
108-
- name: Master Toolchain Setup
109-
run: bash setup-toolchain.sh
110-
env:
111-
HOST_TOOLCHAIN: ${{ matrix.host }}
91+
# HACK(flip1995): This is here to install the correct toolchain
92+
- name: Print cargo version
93+
run: cargo -V
11294

11395
# Run
11496
- name: Set LD_LIBRARY_PATH (Linux)
@@ -128,13 +110,13 @@ jobs:
128110
SYSROOT=$(rustc --print sysroot)
129111
echo "$SYSROOT/bin" >> $GITHUB_PATH
130112
131-
- name: Build with internal lints
113+
- name: Build
132114
run: cargo build --features deny-warnings,internal-lints
133115

134-
- name: Test with internal lints
116+
- name: Test
135117
run: cargo test --features deny-warnings,internal-lints
136118

137-
- name: Test clippy_lints with internal lints
119+
- name: Test clippy_lints
138120
run: cargo test --features deny-warnings,internal-lints
139121
working-directory: clippy_lints
140122

@@ -155,12 +137,6 @@ jobs:
155137
env:
156138
OS: ${{ runner.os }}
157139

158-
# Cleanup
159-
- name: Run cargo-cache --autoclean
160-
run: |
161-
cargo +nightly install cargo-cache --no-default-features --features ci-autoclean cargo-cache
162-
cargo cache
163-
164140
integration_build:
165141
needs: changelog
166142
runs-on: ubuntu-latest
@@ -171,29 +147,12 @@ jobs:
171147
with:
172148
github_token: "${{ secrets.github_token }}"
173149

174-
- name: rust-toolchain
175-
uses: actions-rs/[email protected]
176-
with:
177-
toolchain: nightly
178-
target: x86_64-unknown-linux-gnu
179-
profile: minimal
180-
181150
- name: Checkout
182151
uses: actions/[email protected]
183152

184-
- name: Run cargo update
185-
run: cargo update
186-
187-
- name: Cache cargo dir
188-
uses: actions/cache@v2
189-
with:
190-
path: ~/.cargo
191-
key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('Cargo.lock') }}
192-
restore-keys: |
193-
${{ runner.os }}-x86_64-unknown-linux-gnu
194-
195-
- name: Master Toolchain Setup
196-
run: bash setup-toolchain.sh
153+
# HACK(flip1995): This is here to install the correct toolchain
154+
- name: Print cargo version
155+
run: cargo -V
197156

198157
# Run
199158
- name: Build Integration Test
@@ -214,11 +173,6 @@ jobs:
214173
name: target
215174
path: target
216175

217-
# Cleanup
218-
- name: Run cargo-cache --autoclean
219-
run: |
220-
cargo +nightly install cargo-cache --no-default-features --features ci-autoclean cargo-cache
221-
cargo cache
222176
integration:
223177
needs: integration_build
224178
strategy:
@@ -227,16 +181,14 @@ jobs:
227181
matrix:
228182
integration:
229183
- 'rust-lang/cargo'
230-
# FIXME: re-enable once fmt_macros is renamed in RLS
231-
# - 'rust-lang/rls'
184+
- 'rust-lang/rls'
232185
- 'rust-lang/chalk'
233186
- 'rust-lang/rustfmt'
234187
- 'Marwes/combine'
235188
- 'Geal/nom'
236189
- 'rust-lang/stdarch'
237190
- 'serde-rs/serde'
238-
# FIXME: chrono currently cannot be compiled with `--all-targets`
239-
# - 'chronotope/chrono'
191+
- 'chronotope/chrono'
240192
- 'hyperium/hyper'
241193
- 'rust-random/rand'
242194
- 'rust-lang/futures-rs'
@@ -252,29 +204,12 @@ jobs:
252204
with:
253205
github_token: "${{ secrets.github_token }}"
254206

255-
- name: rust-toolchain
256-
uses: actions-rs/[email protected]
257-
with:
258-
toolchain: nightly
259-
target: x86_64-unknown-linux-gnu
260-
profile: minimal
261-
262207
- name: Checkout
263208
uses: actions/[email protected]
264209

265-
- name: Run cargo update
266-
run: cargo update
267-
268-
- name: Cache cargo dir
269-
uses: actions/cache@v2
270-
with:
271-
path: ~/.cargo
272-
key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('Cargo.lock') }}
273-
restore-keys: |
274-
${{ runner.os }}-x86_64-unknown-linux-gnu
275-
276-
- name: Master Toolchain Setup
277-
run: bash setup-toolchain.sh
210+
# HACK(flip1995): This is here to install the correct toolchain
211+
- name: Print cargo version
212+
run: cargo -V
278213

279214
# Download
280215
- name: Download target dir
@@ -293,12 +228,6 @@ jobs:
293228
INTEGRATION: ${{ matrix.integration }}
294229
RUSTUP_TOOLCHAIN: master
295230

296-
# Cleanup
297-
- name: Run cargo-cache --autoclean
298-
run: |
299-
cargo +nightly install cargo-cache --no-default-features --features ci-autoclean cargo-cache
300-
cargo cache
301-
302231
# These jobs doesn't actually test anything, but they're only used to tell
303232
# bors the build completed, as there is no practical way to detect when a
304233
# workflow is successful listening to webhooks only.

.github/workflows/clippy_dev.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,20 @@ jobs:
2222

2323
steps:
2424
# Setup
25+
- name: Checkout
26+
uses: actions/[email protected]
27+
28+
- name: remove toolchain file
29+
run: rm rust-toolchain
30+
2531
- name: rust-toolchain
2632
uses: actions-rs/[email protected]
2733
with:
2834
toolchain: nightly
2935
target: x86_64-unknown-linux-gnu
3036
profile: minimal
3137
components: rustfmt
32-
33-
- name: Checkout
34-
uses: actions/[email protected]
38+
default: true
3539

3640
# Run
3741
- name: Build

CONTRIBUTING.md

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ But we can make it nest-less by using [if_chain] macro, [like this][nest-less].
7070

7171
[`E-medium`] issues are generally pretty easy too, though it's recommended you work on an [`good first issue`]
7272
first. Sometimes they are only somewhat involved code wise, but not difficult per-se.
73-
Note that [`E-medium`] issues may require some knowledge of Clippy internals or some
74-
debugging to find the actual problem behind the issue.
73+
Note that [`E-medium`] issues may require some knowledge of Clippy internals or some
74+
debugging to find the actual problem behind the issue.
7575

7676
[`T-middle`] issues can be more involved and require verifying types. The [`ty`] module contains a
7777
lot of methods that are useful, though one of the most useful would be `expr_ty` (gives the type of
@@ -182,18 +182,26 @@ That's why the `else_if_without_else` example uses the `register_early_pass` fun
182182
[early_lint_pass]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint/trait.EarlyLintPass.html
183183
[late_lint_pass]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint/trait.LateLintPass.html
184184

185-
## Fixing build failures caused by Rust
185+
## Syncing changes between Clippy and [`rust-lang/rust`]
186186

187-
Clippy currently gets built with `rustc` of the `rust-lang/rust` `master`
188-
branch. Most of the times we have to adapt to the changes and only very rarely
189-
there's an actual bug in Rust.
187+
Clippy currently gets built with a pinned nightly version.
190188

191-
If you decide to make Clippy work again with a Rust commit that breaks it, you
192-
have to sync the `rust-lang/rust-clippy` repository with the `subtree` copy of
193-
Clippy in the `rust-lang/rust` repository.
189+
In the `rust-lang/rust` repository, where rustc resides, there's a copy of Clippy
190+
that compiler hackers modify from time to time to adapt to changes in the unstable
191+
API of the compiler.
194192

195-
For general information about `subtree`s in the Rust repository see [Rust's
196-
`CONTRIBUTING.md`][subtree].
193+
We need to sync these changes back to this repository periodically, and the changes
194+
made to this repository in the meantime also need to be synced to the `rust-lang/rust` repository.
195+
196+
To avoid flooding the `rust-lang/rust` PR queue, this two-way sync process is done
197+
in a bi-weekly basis if there's no urgent changes. This is done starting on the day of
198+
the Rust stable release and then every other week. That way we guarantee that we keep
199+
this repo up to date with the latest compiler API, and every feature in Clippy is available
200+
for 2 weeks in nightly, before it can get to beta. For reference, the first sync
201+
following this cadence was performed the 2020-08-27.
202+
203+
This process is described in detail in the following sections. For general information
204+
about `subtree`s in the Rust repository see [Rust's `CONTRIBUTING.md`][subtree].
197205

198206
### Patching git-subtree to work with big repos
199207

@@ -222,13 +230,14 @@ This shell has a hardcoded recursion limit set to 1000. In order to make this pr
222230
you need to force the script to run `bash` instead. You can do this by editing the first
223231
line of the `git-subtree` script and changing `sh` to `bash`.
224232

225-
### Performing the sync
233+
### Performing the sync from [`rust-lang/rust`] to Clippy
226234

227235
Here is a TL;DR version of the sync process (all of the following commands have
228236
to be run inside the `rust` directory):
229237

230-
1. Clone the [`rust-lang/rust`] repository
231-
2. Sync the changes to the rust-copy of Clippy to your Clippy fork:
238+
1. Clone the [`rust-lang/rust`] repository or make sure it is up to date.
239+
2. Checkout the commit from the latest available nightly. You can get it using `rustup check`.
240+
3. Sync the changes to the rust-copy of Clippy to your Clippy fork:
232241
```bash
233242
# Make sure to change `your-github-name` to your github name in the following command
234243
git subtree push -P src/tools/clippy [email protected]:your-github-name/rust-clippy sync-from-rust
@@ -246,17 +255,11 @@ to be run inside the `rust` directory):
246255
git checkout sync-from-rust
247256
git merge upstream/master
248257
```
249-
3. Open a PR to `rust-lang/rust-clippy` and wait for it to get merged (to
258+
4. Open a PR to `rust-lang/rust-clippy` and wait for it to get merged (to
250259
accelerate the process ping the `@rust-lang/clippy` team in your PR and/or
251260
~~annoy~~ ask them in the [Zulip] stream.)
252-
253-
### Syncing back changes in Clippy to [`rust-lang/rust`]
254261

255-
To avoid flooding the [`rust-lang/rust`] PR queue, changes in Clippy's repo are synced back
256-
in a bi-weekly basis if there's no urgent changes. This is done starting on the day of
257-
the Rust stable release and then every other week. That way we guarantee that
258-
every feature in Clippy is available for 2 weeks in nightly, before it can get to beta.
259-
For reference, the first sync following this cadence was performed the 2020-08-27.
262+
### Performing the sync from Clippy to [`rust-lang/rust`]
260263

261264
All of the following commands have to be run inside the `rust` directory.
262265

0 commit comments

Comments
 (0)