Skip to content

Commit 50de7f0

Browse files
update rustfmt references to reflect change from submod to subtree (#1129)
* update rustfmt references to reflect change to subtree * clarify broken toolstate hypothetical scenario
1 parent 8faa164 commit 50de7f0

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

src/contributing.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ the issue in question.
169169
As a developer to this repository, you don't have to treat the following external projects
170170
differently from other crates that are directly in this repo:
171171

172-
* Clippy
172+
* [Clippy](https://github.com/rust-lang/rust-clippy)
173+
* [rustfmt](https://github.com/rust-lang/rustfmt)
173174

174175
They are just regular files and directories. This is in contrast to `submodule` dependencies
175176
(see below for those). Only tool authors will actually use any operations here.
@@ -233,7 +234,6 @@ subtrees) actually needs to use `git subtree`.
233234
Currently building Rust will also build the following external projects:
234235

235236
* [miri](https://github.com/rust-lang/miri)
236-
* [rustfmt](https://github.com/rust-lang/rustfmt)
237237
* [rls](https://github.com/rust-lang/rls/)
238238

239239
We allow breakage of these tools in the nightly channel. Maintainers of these
@@ -261,16 +261,16 @@ before the PR is merged.
261261
Rust's build system builds a number of tools that make use of the
262262
internals of the compiler. This includes
263263
[RLS](https://github.com/rust-lang/rls) and
264-
[rustfmt](https://github.com/rust-lang/rustfmt). If these tools
264+
[miri](https://github.com/rust-lang/miri). If these tools
265265
break because of your changes, you may run into a sort of "chicken and egg"
266266
problem. These tools rely on the latest compiler to be built so you can't update
267267
them to reflect your changes to the compiler until those changes are merged into
268268
the compiler. At the same time, you can't get your changes merged into the compiler
269269
because the rust-lang/rust build won't pass until those tools build and pass their
270270
tests.
271271

272-
That means that, in the default state, you can't update the compiler without first
273-
fixing rustfmt, rls and the other tools that the compiler builds.
272+
That would mean that, in the default state, you couldn't update the compiler without first
273+
fixing miri, rls and the other tools that the compiler builds.
274274

275275
Luckily, a feature was [added to Rust's build](https://github.com/rust-lang/rust/issues/45861)
276276
to make all of this easy to handle. The idea is that we allow these tools to be "broken",
@@ -280,7 +280,7 @@ and the tools are working again, you go back in the compiler and update the tool
280280
so they can be distributed again.
281281

282282
This should avoid a bunch of synchronization dances and is also much easier on contributors as
283-
there's no need to block on rls/rustfmt/other tools changes going upstream.
283+
there's no need to block on rls/miri/other tools changes going upstream.
284284

285285
Here are those same steps in detail:
286286

@@ -290,8 +290,8 @@ Here are those same steps in detail:
290290
from resetting to the original branch after you make your changes. If you
291291
need to [update any submodules to their latest versions](#updating-submodules),
292292
see the section of this file about that for more information.
293-
2. (optional) Run `./x.py test src/tools/rustfmt` (substituting the submodule
294-
that broke for `rustfmt`). Fix any errors in the submodule (and possibly others).
293+
2. (optional) Run `./x.py test src/tools/rls` (substituting the submodule
294+
that broke for `rls`). Fix any errors in the submodule (and possibly others).
295295
3. (optional) Make commits for your changes and send them to upstream repositories as a PR.
296296
4. (optional) Maintainers of these submodules will **not** merge the PR. The PR can't be
297297
merged because CI will be broken. You'll want to write a message on the PR referencing
@@ -303,27 +303,27 @@ Here are those same steps in detail:
303303

304304
#### Updating submodules
305305

306-
These instructions are specific to updating `rustfmt`, however they may apply
306+
These instructions are specific to updating `rls`, however they may apply
307307
to the other submodules as well. Please help by improving these instructions
308308
if you find any discrepancies or special cases that need to be addressed.
309309

310-
To update the `rustfmt` submodule, start by running the appropriate
310+
To update the `rls` submodule, start by running the appropriate
311311
[`git submodule` command](https://git-scm.com/book/en/v2/Git-Tools-Submodules).
312312
For example, to update to the latest commit on the remote master branch,
313313
you may want to run:
314314
```
315-
git submodule update --remote src/tools/rustfmt
315+
git submodule update --remote src/tools/rls
316316
```
317317
If you run `./x.py build` now, and you are lucky, it may just work. If you see
318318
an error message about patches that did not resolve to any crates, you will need
319319
to complete a few more steps which are outlined with their rationale below.
320320

321321
*(This error may change in the future to include more information.)*
322322
```
323-
error: failed to resolve patches for `https://github.com/rust-lang/rustfmt`
323+
error: failed to resolve patches for `https://github.com/rust-lang/rls`
324324
325325
Caused by:
326-
patch for `rustfmt-nightly` in `https://github.com/rust-lang/rustfmt` did not resolve to any crates
326+
patch for `rls` in `https://github.com/rust-lang/rls` did not resolve to any crates
327327
failed to run: ~/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path ~/rust/src/bootstrap/Cargo.toml
328328
```
329329

@@ -354,14 +354,14 @@ reveals what the problem is:
354354
> crates.io, but it's important to keep this in mind!
355355
356356
This says that when we updated the submodule, the version number in our
357-
`src/tools/rustfmt/Cargo.toml` changed. The new version is different from
357+
`src/tools/rls/Cargo.toml` changed. The new version is different from
358358
the version in `Cargo.lock`, so the build can no longer continue.
359359

360360
To resolve this, we need to update `Cargo.lock`. Luckily, cargo provides a
361361
command to do this easily.
362362

363363
```
364-
$ cargo update -p rustfmt-nightly
364+
$ cargo update -p rls
365365
```
366366

367367
This should change the version listed in `Cargo.lock` to the new version you updated

src/git.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ Changes not staged for commit:
139139
(use "git restore <file>..." to discard changes in working directory)
140140
modified: src/tools/cargo (new commits)
141141
modified: src/tools/rls (new commits)
142-
modified: src/tools/rustfmt (new commits)
143142
144143
no changes added to commit (use "git add" and/or "git commit -a")
145144
```
@@ -347,9 +346,9 @@ you might want to get used to the main concepts of Git before reading this secti
347346

348347
The `rust-lang/rust` repository uses [Git submodules] as a way to use other
349348
Rust projects from within the `rust` repo. Examples include Rust's fork of
350-
`llvm-project` and many devtools such as `cargo`, `rust-analyzer` and `rustfmt`.
349+
`llvm-project` and many devtools such as `cargo`, `rust-analyzer` and `rls`.
351350

352-
Those projects are developped and maintained in an separate Git (and GitHub)
351+
Those projects are developed and maintained in an separate Git (and GitHub)
353352
repository, and they have their own Git history/commits, issue tracker and PRs.
354353
Submodules allow us to create some sort of embedded sub-repository inside the
355354
`rust` repository and use them like they were directories in the `rust` repository.

0 commit comments

Comments
 (0)