@@ -12,6 +12,22 @@ on the [Rust Zulip].
1212
1313[ Rust Zulip ] : https://rust-lang.zulipchat.com
1414
15+ ## Building Miri with a pre-built rustc
16+
17+ Miri heavily relies on internal rustc interfaces to execute MIR. Still, some
18+ things (like adding support for a new intrinsic or a shim for an external
19+ function being called) can be done by working just on the Miri side.
20+
21+ The ` rust-version ` file contains the commit hash of rustc that Miri is currently
22+ tested against. Other versions will likely not work. After installing
23+ [ ` rustup-toolchain-install-master ` ] , you can run the following command to
24+ install that exact version of rustc as a toolchain:
25+ ```
26+ ./rustup-toolchain
27+ ```
28+
29+ [ `rustup-toolchain-install-master` ] : https://github.com/kennytm/rustup-toolchain-install-master
30+
1531### Fixing Miri when rustc changes
1632
1733Miri is heavily tied to rustc internals, so it is very common that rustc changes
@@ -20,36 +36,12 @@ Usually, Miri will require changes similar to the other consumers of the changed
2036rustc API, so reading the rustc PR diff is a good way to get an idea for what is
2137needed.
2238
23- When submitting a PR against Miri after fixing it for rustc changes, make sure
24- you update the ` rust-version ` file. That file always contains the exact rustc
25- git commit with which Miri works, and it is the version that our CI tests Miri
26- against.
27-
28- ## Building Miri with a nightly rustc
29-
30- Miri heavily relies on internal rustc interfaces to execute MIR. Still, some
31- things (like adding support for a new intrinsic or a shim for an external
32- function being called) can be done by working just on the Miri side.
33-
34- To prepare, make sure you are using a nightly Rust compiler. You also need to
35- have the ` rust-src ` and ` rustc-dev ` components installed, which you can add via
36- ` rustup component add rust-src rustc-dev ` . Then you should be able to just
37- ` cargo build ` Miri.
38-
39- In case this fails, your nightly might be incompatible with Miri master. The
40- ` rust-version ` file contains the commit hash of rustc that Miri is currently
41- tested against; you can use that to find a nightly that works or you might have
42- to wait for the next nightly to get released. You can also use
43- [ ` rustup-toolchain-install-master ` ] ( https://github.com/kennytm/rustup-toolchain-install-master )
44- to install that exact version of rustc as a toolchain:
39+ To update the ` rustc-version ` file and install the latest rustc, you can run:
4540```
46- rustup-toolchain-install-master $(cat rust-version) -c rust-src -c rustc-dev
41+ ./ rustup-toolchain HEAD
4742```
4843
49- Another common problem is outdated dependencies: Miri does not come with a
50- lockfile (it cannot, due to how it gets embedded into the rustc build). So you
51- have to run ` cargo update ` every now and then yourself to make sure you are
52- using the latest versions of everything (which is what gets tested on CI).
44+ Now try ` ./miri test ` , and submit a PR once that works again.
5345
5446## Testing the Miri driver
5547[ testing-miri ] : #testing-the-miri-driver
0 commit comments