Skip to content

Commit bd4907d

Browse files
committed
Documenting the process for when rustfmt/rls breakk because of your changes
1 parent f6d7514 commit bd4907d

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

CONTRIBUTING.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,44 @@ outside the submodule.
363363
It can also be more convenient during development to set `submodules = false`
364364
in the `config.toml` to prevent `x.py` from resetting to the original branch.
365365

366+
#### Breaking rustfmt or rls
367+
368+
Rust's build system also builds the
369+
[RLS](https://github.com/rust-lang-nursery/rls)
370+
and [rustfmt](https://github.com/rust-lang-nursery/rustfmt). If these tools
371+
break because of your changes, you may run into a sort of "chicken and egg"
372+
problem. Both tools rely on the latest compiler to be built so you can't update
373+
them until the changes you are making to the compiler land. In the meantime, you
374+
can't land your changes to the compiler because the build won't pass until those
375+
tools are fixed.
376+
377+
That means that, in the default state, you can't update the compiler without
378+
fixing rustfmt and rls first.
379+
380+
When this happens, follow these steps:
381+
382+
1. First, if it doesn't exist already, create a `config.toml` by copying
383+
`config.toml.example` in the root directory of the Rust repository.
384+
Set `submodules = false` in the `[build]` section. This will prevent `x.py`
385+
from resetting to the original branch after you make your changes.
386+
2. Run `./x.py test src/tools/rustfmt`. Fix any errors in the submodule itself
387+
(the `src/tools/rustfmt` directory) until it works.
388+
3. Run `./x.py test src/tools/rls`. Fix any errors in the submodule itself
389+
(the `src/tools/rls` directory) until it works.
390+
4. Make a commit for `rustfmt`, if necessary, and send a PR to the master
391+
branch of rust-lang-nursery/rustfmt
392+
5. Do the same, if necessary for the RLS
393+
6. A maintainer of rls/rustfmt will **not** merge the PR. The PR can't be
394+
merged because CI will be broken. Instead a new branch will be created,
395+
and the PR will be pushed to the branch (the PR is left open)
396+
7. On your branch, update the rls/rustfmt submodules to these branches
397+
8. Commit the changes, update your PR to rust-lang/rust
398+
9. Wait for the branch to merge
399+
10. Wait for a nightly
400+
11. A maintainer of rls/rustfmt will merge the original PRs to rls/rustfmt
401+
12. Eventually the rls/rustfmt submodules will get re-updated back to the
402+
master branch
403+
366404
## Writing Documentation
367405
[writing-documentation]: #writing-documentation
368406

0 commit comments

Comments
 (0)