@@ -363,46 +363,56 @@ outside the submodule.
363363It can also be more convenient during development to set ` submodules = false `
364364in the ` config.toml ` to prevent ` x.py ` from resetting to the original branch.
365365
366- #### Breaking rustfmt or rls
367- [ breaking-rustfmt-or-rls ] : #breaking-rustfmt-or-rls
366+ #### Breaking Tools Built With The Compiler
367+ [ breaking-tools-built-with-the-compiler ] : #breaking-tools-built-with-the-compiler
368368
369- Rust's build system also builds the
370- [ RLS] ( https://github.com/rust-lang-nursery/rls )
371- and [ rustfmt] ( https://github.com/rust-lang-nursery/rustfmt ) . If these tools
369+ Rust's build system builds a number of tools that make use of the
370+ internals of the compiler. This includes clippy,
371+ [ RLS] ( https://github.com/rust-lang-nursery/rls ) and
372+ [ rustfmt] ( https://github.com/rust-lang-nursery/rustfmt ) . If these tools
372373break because of your changes, you may run into a sort of "chicken and egg"
373- problem. Both tools rely on the latest compiler to be built so you can't update
374- them until the changes you are making to the compiler land. In the meantime, you
375- can't land your changes to the compiler because the build won't pass until those
376- tools are fixed.
374+ problem. These tools rely on the latest compiler to be built so you can't update
375+ them to reflect your changes to the compiler until those changes are merged into
376+ the compiler. At the same time, you can't get your changes merged into the compiler
377+ because the rust-lang/rust build won't pass until those tools build and pass their
378+ tests.
377379
378- That means that, in the default state, you can't update the compiler without
379- fixing rustfmt and rls first .
380+ That means that, in the default state, you can't update the compiler without first
381+ fixing rustfmt, rls and the other tools that the compiler builds .
380382
381- When this happens, follow these steps:
383+ Luckily, a feature was [ added to Rust's build] ( https://github.com/rust-lang/rust/pull/45243 )
384+ to make all of this easy to handle. The idea is that you mark the tools as "broken",
385+ so that the rust-lang/rust build passes without trying to build them, then land the change
386+ in the compiler, wait for a nightly, and go update the tools that you broke. Once you're done
387+ and the tools are working again, you go back in the compiler and change the tools back
388+ from "broken".
382389
383- 1 . First, if it doesn't exist already, create a ` config.toml ` by copying
390+ This should avoid a bunch of synchronization dances and is also much easier on contributors as
391+ there's no need to block on rls/rustfmt/other tools changes going upstream.
392+
393+ Here are those same steps in detail:
394+
395+ 1 . (optional) First, if it doesn't exist already, create a ` config.toml ` by copying
384396 ` config.toml.example ` in the root directory of the Rust repository.
385397 Set ` submodules = false ` in the ` [build] ` section. This will prevent ` x.py `
386398 from resetting to the original branch after you make your changes. If you
387399 need to [ update any submodules to their latest versions] [ updating-submodules ] ,
388400 see the section of this file about that for more information.
389- 2 . Run ` ./x.py test src/tools/rustfmt ` . Fix any errors in the submodule itself
390- (the ` src/tools/rustfmt ` directory) until it works.
391- 3 . Run ` ./x.py test src/tools/rls ` . Fix any errors in the submodule itself
392- (the ` src/tools/rls ` directory) until it works.
393- 4 . Make a commit for ` rustfmt ` , if necessary, and send a PR to the master
394- branch of rust-lang-nursery/rustfmt
395- 5 . Do the same, if necessary for the RLS
396- 6 . A maintainer of rls/rustfmt will ** not** merge the PR. The PR can't be
397- merged because CI will be broken. Instead a new branch will be created,
398- and the PR will be pushed to the branch (the PR is left open)
399- 7 . On your branch, update the rls/rustfmt submodules to these branches
400- 8 . Commit the changes, update your PR to rust-lang/rust
401- 9 . Wait for the branch to merge
402- 10 . Wait for a nightly
403- 11 . A maintainer of rls/rustfmt will merge the original PRs to rls/rustfmt
404- 12 . Eventually the rls/rustfmt submodules will get re-updated back to the
405- master branch
401+ 2 . (optional) Run ` ./x.py test src/tools/rustfmt ` (substituting the submodule
402+ that broke for ` rustfmt ` ). Fix any errors in the submodule (and possibly others).
403+ 3 . (optional) Make commits for your changes and send them to upstream repositories as a PR.
404+ 4 . (optional) Maintainers of these submodules will ** not** merge the PR. The PR can't be
405+ merged because CI will be broken. You'll want to write a message on the PR referencing
406+ your change, and how the PR should be merged once your change makes it into a nightly.
407+ 5 . Update ` src/tools/toolstate.toml ` to indicate that the tool in question is "broken",
408+ that will disable building it on CI. See the documentation in that file for the exact
409+ configuration values you can use.
410+ 6 . Commit the changes to ` src/tools/toolstate.toml ` , ** do not update submodules in your commit** ,
411+ and then update the PR you have for rust-lang/rust.
412+ 7 . Wait for your PR to merge.
413+ 8 . Wait for a nightly
414+ 9 . (optional) Help land your PR on the upstream repository now that your changes are in nightly.
415+ 10 . (optional) Send a PR to rust-lang/rust updating the submodule, reverting ` src/tools/toolstate.toml ` back to a "building" or "testing" state.
406416
407417#### Updating submodules
408418[ updating-submodules ] : #updating-submodules
0 commit comments