Skip to content

Commit a74436e

Browse files
committed
Auto merge of rust-lang#2587 - RalfJung:josh, r=RalfJung
add josh instructions This explains how to sync Miri changes to and from rustc.
2 parents 85f449a + 11c593f commit a74436e

File tree

1 file changed

+51
-2
lines changed

1 file changed

+51
-2
lines changed

CONTRIBUTING.md

+51-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ MIRI_LOG=rustc_mir::interpret=info,miri::stacked_borrows ./miri run tests/pass/v
104104
In addition, you can set `MIRI_BACKTRACE=1` to get a backtrace of where an
105105
evaluation error was originally raised.
106106

107-
#### UI testing
107+
### UI testing
108108

109109
We use ui-testing in Miri, meaning we generate `.stderr` and `.stdout` files for the output
110110
produced by Miri. You can use `./miri bless` to automatically (re)generate these files when
@@ -257,7 +257,7 @@ Note: When you are working with a locally built rustc or any other toolchain tha
257257
is not the same as the one in `rust-version`, you should not have `.auto-everything` or
258258
`.auto-toolchain` as that will keep resetting your toolchain.
259259

260-
```
260+
```sh
261261
rm -f .auto-everything .auto-toolchain
262262
```
263263

@@ -275,3 +275,52 @@ see <https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html>.
275275

276276
With this, you should now have a working development setup! See
277277
[above](#building-and-testing-miri) for how to proceed working on Miri.
278+
279+
## Advanced topic: Syncing with the rustc repo
280+
281+
We use the [`josh` proxy](https://github.com/josh-project/josh) to transmit
282+
changes between the rustc and Miri repositories. For now, josh needs to be built
283+
from source. This downloads and runs josh:
284+
285+
```sh
286+
git clone https://github.com/josh-project/josh
287+
cd josh
288+
git checkout @changes/master/[email protected]/start-filter
289+
cargo run --release -p josh-proxy -- --local=$(pwd)/local --remote=https://github.com --no-background
290+
```
291+
292+
### Importing changes from the rustc repo
293+
294+
We assume we start on an up-to-date master branch in the Miri repo.
295+
296+
```sh
297+
# Fetch rustc side of the history. Takes ca 5 min the first time.
298+
# Do NOT change that commit ID, it needs to be exactly this!
299+
git fetch http://localhost:8000/rust-lang/rust.git:at_commit=75dd959a3a40eb5b4574f8d2e23aa6efbeb33573[:prefix=src/tools/miri]:/src/tools/miri.git master
300+
# Include that history into ours.
301+
git merge FETCH_HEAD -m "merge rustc history"
302+
# Update toolchain reference and apply formatting.
303+
./rustup-toolchain HEAD && ./miri fmt
304+
git commit -am "rustup"
305+
```
306+
307+
Now push this to a new branch in your Miri fork, and create a PR. It is worth
308+
running `./miri test` locally in parallel, since the test suite in the Miri repo
309+
is stricter than the one on the rustc side, so some small tweaks might be
310+
needed.
311+
312+
### Exporting changes to the rustc repo
313+
314+
We will use the josh proxy to push to your fork of rustc. You need to make sure
315+
that the master branch of your fork is up-to-date. Also make sure that there
316+
exists no branch called `miri` in your fork. Then run the following in the Miri
317+
repo, assuming we are on an up-to-date master branch:
318+
319+
```sh
320+
# Push the Miri changes to your rustc fork (substitute your github handle for YOUR_NAME).
321+
# Do NOT change that commit ID, it needs to be exactly this!
322+
git push http://localhost:8000/YOUR_NAME/rust.git:at_commit=75dd959a3a40eb5b4574f8d2e23aa6efbeb33573[:prefix=src/tools/miri]:/src/tools/miri.git -o base=master HEAD:miri
323+
```
324+
325+
This will create a new branch in your fork, and the output should include a link
326+
to create a rustc PR that will integrate those changes into the main repository.

0 commit comments

Comments
 (0)