Skip to content

Commit 17d877c

Browse files
committed
Update contributing section about syncing Clippy
1 parent d270887 commit 17d877c

File tree

1 file changed

+31
-41
lines changed

1 file changed

+31
-41
lines changed

CONTRIBUTING.md

Lines changed: 31 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -155,47 +155,37 @@ That's why the `else_if_without_else` example uses the `register_early_pass` fun
155155

156156
## Fixing build failures caused by Rust
157157

158-
Clippy will sometimes fail to build from source because building it depends on unstable internal Rust features. Most of
159-
the times we have to adapt to the changes and only very rarely there's an actual bug in Rust. Fixing build failures
160-
caused by Rust updates, can be a good way to learn about Rust internals.
161-
162-
In order to find out why Clippy does not work properly with a new Rust commit, you can use the [rust-toolstate commit
163-
history][toolstate_commit_history]. You will then have to look for the last commit that contains
164-
`test-pass -> build-fail` or `test-pass -> test-fail` for the `clippy-driver` component.
165-
[Here][toolstate_commit] is an example.
166-
167-
The commit message contains a link to the PR. The PRs are usually small enough to discover the breaking API change and
168-
if they are bigger, they likely include some discussion that may help you to fix Clippy.
169-
170-
To check if Clippy is available for a specific target platform, you can check
171-
the [rustup component history][rustup_component_history].
172-
173-
If you decide to make Clippy work again with a Rust commit that breaks it,
174-
you probably want to install the latest Rust from master locally and run Clippy
175-
using that version of Rust.
176-
177-
You can set up the master toolchain by running `./setup-toolchain.sh`. That script will install
178-
[rustup-toolchain-install-master][rtim] and master toolchain, then run `rustup override set master`.
179-
180-
After fixing the build failure on this repository, we can submit a pull request
181-
to [`rust-lang/rust`] to fix the toolstate.
182-
183-
To submit a pull request, you should follow these steps:
184-
185-
```bash
186-
# Assuming you already cloned the rust-lang/rust repo and you're in the correct directory
187-
git submodule update --remote src/tools/clippy
188-
cargo update -p clippy
189-
git add -u
190-
git commit -m "Update Clippy"
191-
./x.py test -i --stage 1 src/tools/clippy # This is optional and should succeed anyway
192-
# Open a PR in rust-lang/rust
193-
```
194-
195-
[rustup_component_history]: https://rust-lang.github.io/rustup-components-history
196-
[toolstate_commit_history]: https://github.com/rust-lang-nursery/rust-toolstate/commits/master
197-
[toolstate_commit]: https://github.com/rust-lang-nursery/rust-toolstate/commit/aad74d8294e198a7cf8ac81a91aebb7f3bbcf727
198-
[rtim]: https://github.com/kennytm/rustup-toolchain-install-master
158+
Clippy currently gets build with `rustc` of the `rust-lang/rust` `master`
159+
branch. Most of the times we have to adapt to the changes and only very rarely
160+
there's an actual bug in Rust.
161+
162+
If you decide to make Clippy work again with a Rust commit that breaks it, you
163+
have to sync the `rust-lang/rust-clippy` repository with the `subtree` copy of
164+
Clippy in the `rust-lang/rust` repository.
165+
166+
For general information about `subtree`s in the Rust repository see [Rust's
167+
`CONTRIBUTING.md`][subtree].
168+
169+
Here is a TL;DR version of the sync process:
170+
171+
1. Clone the [`rust-lang/rust`] repository (all of the following commands have
172+
to be run inside the `rust` directory)
173+
2. Sync the changes to the copy of Clippy to your fork of the Clippy repository:
174+
```bash
175+
# Make sure to change `your-github-name` to your github name in the following command
176+
git subtree push -P src/tools/clippy git@github.com:your-github-name/rust-clippy sync-from-rust
177+
```
178+
3. Open a PR to `rust-lang/rust-clippy` and wait for it to get merged (to
179+
accelerate the process ping the `@rust-lang/clippy` team in your PR and/or
180+
~~annoy~~ ask them in the [Discord] channel.)
181+
4. Sync the `rust-lang/rust-clippy` master to the copy of Clippy:
182+
```bash
183+
git checkout -b sync-from-clippy
184+
git subtree pull -P src/tools/clippy https://github.com/rust-lang/rust-clippy master
185+
```
186+
5. Open a PR to [`rust-lang/rust`]
187+
188+
[subtree]: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#external-dependencies-subtree
199189
[`rust-lang/rust`]: https://github.com/rust-lang/rust
200190

201191
## Issue and PR triage

0 commit comments

Comments
 (0)