Skip to content

Commit 0a2f713

Browse files
authored
miri is no longer a submodule but a subtree. (#1488)
1 parent 736fcb9 commit 0a2f713

File tree

2 files changed

+24
-39
lines changed

2 files changed

+24
-39
lines changed

Diff for: src/contributing.md

+9-26
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ As a developer to this repository, you don't have to treat the following externa
183183
differently from other crates that are directly in this repo:
184184

185185
* [Clippy](https://github.com/rust-lang/rust-clippy)
186+
* [Miri](https://github.com/rust-lang/miri)
186187
* [rustfmt](https://github.com/rust-lang/rustfmt)
187188
* [rust-analyzer](https://github.com/rust-lang/rust-analyzer)
188189

@@ -257,20 +258,19 @@ some of them are optional (like [Miri]).
257258
Usage of submodules is discussed more in the [Using Git
258259
chapter](git.md#git-submodules).
259260

260-
Some of the submodules are allowed to be in a "broken" state where they either
261-
don't build or their tests don't pass. These include [Miri] and the
262-
documentation books like [The Rust Reference]. Maintainers of these projects
263-
will be notified when the project is in a broken state, and they should fix
264-
them as soon as possible. The current status is tracked on the [toolstate
265-
website]. More information may be found on the Forge [Toolstate chapter].
261+
Some of the submodules are allowed to be in a "broken" state where they
262+
either don't build or their tests don't pass, e.g. the documentation books
263+
like [The Rust Reference]. Maintainers of these projects will be notified
264+
when the project is in a broken state, and they should fix them as soon
265+
as possible. The current status is tracked on the [toolstate website].
266+
More information may be found on the Forge [Toolstate chapter].
266267

267268
Breakage is not allowed in the beta and stable channels, and must be addressed
268269
before the PR is merged. They are also not allowed to be broken on master in
269270
the week leading up to the beta cut.
270271

271272
[git submodules]: https://git-scm.com/book/en/v2/Git-Tools-Submodules
272273
[`.gitmodules`]: https://github.com/rust-lang/rust/blob/master/.gitmodules
273-
[Miri]: https://github.com/rust-lang/miri
274274
[The Rust Reference]: https://github.com/rust-lang/reference/
275275
[toolstate website]: https://rust-lang-nursery.github.io/rust-toolstate/
276276
[Toolstate chapter]: https://forge.rust-lang.org/infra/toolstate.html
@@ -309,8 +309,8 @@ Here are those same steps in detail:
309309
from resetting to the original branch after you make your changes. If you
310310
need to [update any submodules to their latest versions](#updating-submodules),
311311
see the section of this file about that for more information.
312-
2. (optional) Run `./x.py test src/tools/miri` (substituting the submodule
313-
that broke for `miri`). Fix any errors in the submodule (and possibly others).
312+
2. (optional) Run `./x.py test src/tools/cargo` (substituting the submodule
313+
that broke for `cargo`). Fix any errors in the submodule (and possibly others).
314314
3. (optional) Make commits for your changes and send them to upstream repositories as a PR.
315315
4. (optional) Maintainers of these submodules will **not** merge the PR. The PR can't be
316316
merged because CI will be broken. You'll want to write a message on the PR referencing
@@ -320,23 +320,6 @@ Here are those same steps in detail:
320320
7. (optional) Help land your PR on the upstream repository now that your changes are in nightly.
321321
8. (optional) Send a PR to rust-lang/rust updating the submodule.
322322

323-
#### Updating submodules
324-
325-
These instructions are specific to updating `miri`, however they may apply
326-
to the other submodules as well. Please help by improving these instructions
327-
if you find any discrepancies or special cases that need to be addressed.
328-
329-
To update the `miri` submodule, start by running the appropriate
330-
[`git submodule` command](https://git-scm.com/book/en/v2/Git-Tools-Submodules).
331-
For example, to update to the latest commit on the remote master branch,
332-
you may want to run:
333-
```
334-
git submodule update --remote src/tools/miri
335-
```
336-
If you run `./x.py build` now, and you are lucky, it may just work.
337-
338-
To add these changes to a commit, use `git add src/tools/miri` and commit the
339-
change. You can the push and open a PR.
340323

341324
## Writing Documentation
342325

Diff for: src/git.md

+15-13
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ Your branch is up to date with 'origin/master'.
148148
Changes not staged for commit:
149149
(use "git add <file>..." to update what will be committed)
150150
(use "git restore <file>..." to discard changes in working directory)
151+
modified: src/llvm-project (new commits)
151152
modified: src/tools/cargo (new commits)
152-
modified: src/tools/miri (new commits)
153153
154154
no changes added to commit (use "git add" and/or "git commit -a")
155155
```
@@ -176,6 +176,8 @@ There is a workaround in [the issue][#77620-workaround].
176176
[#77620]: https://github.com/rust-lang/rust/issues/77620
177177
[#77620-workaround]: https://github.com/rust-lang/rust/issues/77620#issuecomment-705228229
178178

179+
(Note that as of Sept 2022 `miri` is a subtree and not a submodule.)
180+
179181
## Rebasing and Conflicts
180182

181183
When you edit your code locally, you are making changes to the version of
@@ -391,41 +393,41 @@ you might want to get used to the main concepts of Git before reading this secti
391393

392394
The `rust-lang/rust` repository uses [Git submodules] as a way to use other
393395
Rust projects from within the `rust` repo. Examples include Rust's fork of
394-
`llvm-project` and many devtools such as `cargo` and `miri`.
396+
`llvm-project`, `cargo` and libraries like `stdarch` and `backtrace`.
395397

396398
Those projects are developed and maintained in an separate Git (and GitHub)
397399
repository, and they have their own Git history/commits, issue tracker and PRs.
398400
Submodules allow us to create some sort of embedded sub-repository inside the
399401
`rust` repository and use them like they were directories in the `rust` repository.
400402

401-
Take `miri` for example. `miri` is maintained in the [`rust-lang/miri`] repository,
402-
but it is used in `rust-lang/rust` by the compiler for const evaluation. We bring it
403-
in `rust` as a submodule, in the `src/tools/miri` folder.
403+
Take `llvm-project` for example. `llvm-project` is maintained in the [`rust-lang/llvm-project`]
404+
repository, but it is used in `rust-lang/rust` by the compiler for code generation and
405+
optimization. We bring it in `rust` as a submodule, in the `src/llvm-project` folder.
404406

405407
The contents of submodules are ignored by Git: submodules are in some sense isolated
406-
from the rest of the repository. However, if you try to `cd src/tools/miri` and then
408+
from the rest of the repository. However, if you try to `cd src/llvm-project` and then
407409
run `git status`:
408410

409411
```
410-
HEAD detached at 3fafb835
412+
HEAD detached at 9567f08afc943
411413
nothing to commit, working tree clean
412414
```
413415

414-
As far as git is concerned, you are no longer in the `rust` repo, but in the `miri` repo.
416+
As far as git is concerned, you are no longer in the `rust` repo, but in the `llvm-project` repo.
415417
You will notice that we are in "detached HEAD" state, i.e. not on a branch but on a
416418
particular commit.
417419

418420
This is because, like any dependency, we want to be able to control which version to use.
419421
Submodules allow us to do just that: every submodule is "pinned" to a certain
420422
commit, which doesn't change unless modified manually. If you use `git checkout <commit>`
421-
in the `miri` directory and go back to the `rust` directory, you can stage this
422-
change like any other, e.g. by running `git add src/tools/miri`. (Note that if
423+
in the `llvm-project` directory and go back to the `rust` directory, you can stage this
424+
change like any other, e.g. by running `git add src/llvm-project`. (Note that if
423425
you *don't* stage the change to commit, then you run the risk that running
424426
`x.py` will just undo your change by switching back to the previous commit when
425427
it automatically "updates" the submodules.)
426428

427429
This version selection is usually done by the maintainers of the project, and
428-
looks like [this][miri-update].
430+
looks like [this][llvm-update].
429431

430432
Git submodules take some time to get used to, so don't worry if it isn't perfectly
431433
clear yet. You will rarely have to use them directly and, again, you don't need
@@ -434,5 +436,5 @@ exist and that they correspond to some sort of embedded subrepository dependency
434436
that Git can nicely and fairly conveniently handle for us.
435437

436438
[Git submodules]: https://git-scm.com/book/en/v2/Git-Tools-Submodules
437-
[`rust-lang/miri`]: https://github.com/rust-lang/miri
438-
[miri-update]: https://github.com/rust-lang/rust/pull/77500/files
439+
[`rust-lang/llvm-project`]: https://github.com/rust-lang/llvm-project
440+
[llvm-update]: https://github.com/rust-lang/rust/pull/99464/files

0 commit comments

Comments
 (0)