Skip to content

Commit 8f811fe

Browse files
committed
update README
1 parent cd25644 commit 8f811fe

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

README.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Several `-Z` flags are relevant for miri:
114114

115115
Since the heart of Miri (the main interpreter engine) lives in rustc, working on
116116
Miri will often require using a locally built rustc. This includes getting a
117-
trace of the execution, as distributed rustc has `trace!` disabled.
117+
trace of the execution, as distributed rustc has `debug!` and `trace!` disabled.
118118

119119
The first-time setup for a local rustc looks as follows:
120120
```
@@ -130,14 +130,28 @@ rustup override set custom
130130
```
131131
The `build` step can take 30 minutes and more.
132132

133-
Now you can `cargo build` Miri, and you can `cargo test --tests`. (`--tests`
134-
is needed to skip doctests because we have not built rustdoc for your custom
135-
toolchain.) You can also set `RUST_LOG=rustc_mir::interpret=trace` as
136-
environment variable to get a step-by-step trace.
133+
Now you can `cargo build` Miri, and you can `cargo test` it. But the key point
134+
is, you can now run Miri with a trace of all execution steps:
135+
136+
```sh
137+
MIRI_LOG=debug cargo run tests/run-pass/vecs.rs
138+
```
139+
140+
Setting `MIRI_LOG` like this will configure logging for miri itself as well as
141+
the `rustc::mir::interpret` and `rustc_mir::interpret` modules in rustc. You
142+
can also do more targeted configuration, e.g. to debug the stacked borrows
143+
implementation:
144+
145+
```sh
146+
MIRI_LOG=miri::stacked_borrows=trace,rustc_mir::interpret=debug cargo run tests/run-pass/vecs.rs
147+
```
148+
149+
In addition, you can set `MIRI_BACKTRACE=1` to get a backtrace of where an
150+
evaluation error was originally created.
137151

138152
If you changed something in rustc and want to re-build, run
139153
```
140-
./x.py build src/rustc --keep-stage 0
154+
./x.py --keep-stage 0 build src/rustc
141155
```
142156
This avoids rebuilding the entire stage 0, which can save a lot of time.
143157

0 commit comments

Comments
 (0)