Skip to content

Commit ff3c4b1

Browse files
committed
Auto merge of #6401 - ebroto:pin_to_a_nightly, r=<try>
📌 Pin Clippy to a nightly 📌 changelog: none 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 + 8f95ae4 commit ff3c4b1

File tree

7 files changed

+30
-126
lines changed

7 files changed

+30
-126
lines changed

.github/workflows/clippy.yml

-10
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ jobs:
3838
- name: rust-toolchain
3939
uses: actions-rs/[email protected]
4040
with:
41-
toolchain: nightly
4241
target: x86_64-unknown-linux-gnu
4342
profile: minimal
4443

@@ -56,15 +55,6 @@ jobs:
5655
restore-keys: |
5756
${{ runner.os }}-x86_64-unknown-linux-gnu
5857
59-
- name: Master Toolchain Setup
60-
run: bash setup-toolchain.sh
61-
62-
# Run
63-
- name: Set LD_LIBRARY_PATH (Linux)
64-
run: |
65-
SYSROOT=$(rustc --print sysroot)
66-
echo "LD_LIBRARY_PATH=${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}" >> $GITHUB_ENV
67-
6858
- name: Build
6959
run: cargo build --features deny-warnings
7060

.github/workflows/clippy_bors.yml

-31
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ jobs:
8787
- name: rust-toolchain
8888
uses: actions-rs/[email protected]
8989
with:
90-
toolchain: nightly
9190
target: ${{ matrix.host }}
9291
profile: minimal
9392

@@ -105,29 +104,7 @@ jobs:
105104
restore-keys: |
106105
${{ runner.os }}-${{ matrix.host }}
107106
108-
- name: Master Toolchain Setup
109-
run: bash setup-toolchain.sh
110-
env:
111-
HOST_TOOLCHAIN: ${{ matrix.host }}
112-
113107
# Run
114-
- name: Set LD_LIBRARY_PATH (Linux)
115-
if: runner.os == 'Linux'
116-
run: |
117-
SYSROOT=$(rustc --print sysroot)
118-
echo "LD_LIBRARY_PATH=${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}" >> $GITHUB_ENV
119-
- name: Link rustc dylib (MacOS)
120-
if: runner.os == 'macOS'
121-
run: |
122-
SYSROOT=$(rustc --print sysroot)
123-
sudo mkdir -p /usr/local/lib
124-
sudo find "${SYSROOT}/lib" -maxdepth 1 -name '*dylib' -exec ln -s {} /usr/local/lib \;
125-
- name: Set PATH (Windows)
126-
if: runner.os == 'Windows'
127-
run: |
128-
SYSROOT=$(rustc --print sysroot)
129-
echo "$SYSROOT/bin" >> $GITHUB_PATH
130-
131108
- name: Build with internal lints
132109
run: cargo build --features deny-warnings,internal-lints
133110

@@ -174,7 +151,6 @@ jobs:
174151
- name: rust-toolchain
175152
uses: actions-rs/[email protected]
176153
with:
177-
toolchain: nightly
178154
target: x86_64-unknown-linux-gnu
179155
profile: minimal
180156

@@ -192,9 +168,6 @@ jobs:
192168
restore-keys: |
193169
${{ runner.os }}-x86_64-unknown-linux-gnu
194170
195-
- name: Master Toolchain Setup
196-
run: bash setup-toolchain.sh
197-
198171
# Run
199172
- name: Build Integration Test
200173
run: cargo test --test integration --features integration --no-run
@@ -255,7 +228,6 @@ jobs:
255228
- name: rust-toolchain
256229
uses: actions-rs/[email protected]
257230
with:
258-
toolchain: nightly
259231
target: x86_64-unknown-linux-gnu
260232
profile: minimal
261233

@@ -273,9 +245,6 @@ jobs:
273245
restore-keys: |
274246
${{ runner.os }}-x86_64-unknown-linux-gnu
275247
276-
- name: Master Toolchain Setup
277-
run: bash setup-toolchain.sh
278-
279248
# Download
280249
- name: Download target dir
281250
uses: actions/download-artifact@v1

.github/workflows/clippy_dev.yml

-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@ jobs:
2525
- name: rust-toolchain
2626
uses: actions-rs/[email protected]
2727
with:
28-
toolchain: nightly
2928
target: x86_64-unknown-linux-gnu
3029
profile: minimal
31-
components: rustfmt
3230

3331
- name: Checkout
3432
uses: actions/[email protected]

CONTRIBUTING.md

+23-20
Original file line numberDiff line numberDiff line change
@@ -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

doc/basics.md

+4-26
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
# Basics for hacking on Clippy
22

33
This document explains the basics for hacking on Clippy. Besides others, this
4-
includes how to set-up the development environment, how to build and how to test
5-
Clippy. For a more in depth description on the codebase take a look at [Adding
6-
Lints] or [Common Tools].
4+
includes how to build and test Clippy. For a more in depth description on
5+
the codebase take a look at [Adding Lints] or [Common Tools].
76

87
[Adding Lints]: https://github.com/rust-lang/rust-clippy/blob/master/doc/adding_lints.md
98
[Common Tools]: https://github.com/rust-lang/rust-clippy/blob/master/doc/common_tools_writing_lints.md
109

1110
- [Basics for hacking on Clippy](#basics-for-hacking-on-clippy)
1211
- [Get the code](#get-the-code)
13-
- [Setup](#setup)
1412
- [Building and Testing](#building-and-testing)
1513
- [`cargo dev`](#cargo-dev)
1614
- [PR](#pr)
@@ -36,31 +34,11 @@ git checkout master
3634
git rebase upstream/master
3735
# push to the master branch of your fork
3836
git push
39-
```
40-
41-
## Setup
42-
43-
Next we need to setup the toolchain to compile Clippy. Since Clippy heavily
44-
relies on compiler internals it is build with the latest rustc master. To get
45-
this toolchain, you can just use the `setup-toolchain.sh` script or use
46-
`rustup-toolchain-install-master`:
47-
48-
```bash
49-
bash setup-toolchain.sh
50-
# OR
51-
cargo install rustup-toolchain-install-master
52-
# For better IDE integration also add `-c rustfmt -c rust-src` (optional)
53-
rustup-toolchain-install-master -f -n master -c rustc-dev -c llvm-tools
54-
rustup override set master
55-
```
56-
57-
_Note:_ Sometimes you may get compiler errors when building Clippy, even if you
58-
didn't change anything. Normally those will be fixed by a maintainer in a few hours.
37+
```
5938

6039
## Building and Testing
6140

62-
Once the `master` toolchain is installed, you can build and test Clippy like
63-
every other Rust project:
41+
You can build and test Clippy like every other Rust project:
6442

6543
```bash
6644
cargo build # builds Clippy

rust-toolchain

+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
nightly
1+
[toolchain]
2+
channel = "nightly-2020-12-09"
3+
components = ["llvm-tools-preview", "rustc-dev", "rust-src", "rustfmt"]

setup-toolchain.sh

-36
This file was deleted.

0 commit comments

Comments
 (0)