Skip to content

Commit c4c8c60

Browse files
committed
update README: 'cargo miri' with full MIR; consistent capitalization
1 parent 034bb25 commit c4c8c60

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

README.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,33 @@ undergraduate research course at the [University of Saskatchewan][usask].
77

88
## Building Miri
99

10-
I recommend that you install [rustup][rustup] to obtain Rust. miri comes with a
10+
I recommend that you install [rustup][rustup] to obtain Rust. Miri comes with a
1111
`rust-toolchain` file so rustup will automatically pick a suitable nightly
1212
version. Then all you have to do is:
1313

1414
```sh
1515
cargo build
1616
```
1717

18-
## Running tests
18+
## Running Miri
1919

2020
```sh
2121
cargo run tests/run-pass/vecs.rs # Or whatever test you like.
2222
```
2323

24-
## Running miri on your own project('s test suite)
25-
26-
Install miri as a cargo subcommand with `cargo install --debug`.
27-
Then, inside your own project, use `cargo +nightly miri` to run your project, if it is
28-
a bin project, or run `cargo +nightly miri test` to run all tests in your project
29-
through miri.
30-
31-
## Running miri with full libstd
24+
## Running Miri with full libstd
3225

3326
Per default libstd does not contain the MIR of non-polymorphic functions. When
34-
miri hits a call to such a function, execution terminates. To fix this, it is
27+
Miri hits a call to such a function, execution terminates. To fix this, it is
3528
possible to compile libstd with full MIR:
3629

3730
```sh
3831
rustup component add rust-src
3932
cargo install xargo
40-
cd xargo/
41-
RUSTFLAGS='-Zalways-encode-mir' xargo build
33+
xargo/build.sh
4234
```
4335

44-
Now you can run miri against the libstd compiled by xargo:
36+
Now you can run Miri against the libstd compiled by xargo:
4537

4638
```sh
4739
MIRI_SYSROOT=~/.xargo/HOST cargo run tests/run-pass-fullmir/hashmap.rs
@@ -50,13 +42,23 @@ MIRI_SYSROOT=~/.xargo/HOST cargo run tests/run-pass-fullmir/hashmap.rs
5042
Notice that you will have to re-run the last step of the preparations above when
5143
your toolchain changes (e.g., when you update the nightly).
5244

53-
You can also set `-Zmiri-start-fn` to make miri start evaluation with the
45+
You can also set `-Zmiri-start-fn` to make Miri start evaluation with the
5446
`start_fn` lang item, instead of starting at the `main` function.
5547

48+
## Running Miri on your own project('s test suite)
49+
50+
Install Miri as a cargo subcommand with `cargo install --all-features`, and install
51+
a full libstd as described above.
52+
53+
Then, inside your own project, use `MIRI_SYSROOT=~/.xargo/HOST cargo +nightly
54+
miri` to run your project, if it is a bin project, or run
55+
`MIRI_SYSROOT=~/.xargo/HOST cargo +nightly miri test` to run all tests in your
56+
project through Miri.
57+
5658
## Development and Debugging
5759

58-
Since the heart of miri (the main interpreter engine) lives in rustc, working on
59-
miri will often require using a locally built rustc. This includes getting a
60+
Since the heart of Miri (the main interpreter engine) lives in rustc, working on
61+
Miri will often require using a locally built rustc. This includes getting a
6062
trace of the execution, as distributed rustc has `trace!` disabled.
6163

6264
The first-time setup for a local rustc looks as follows:
@@ -68,12 +70,12 @@ cp config.toml.example config.toml
6870
./x.py build src/rustc
6971
# You may have to change the architecture in the next command
7072
rustup toolchain link custom build/x86_64-unknown-linux-gnu/stage2
71-
# Now cd to your miri directory
73+
# Now cd to your Miri directory
7274
rustup override set custom
7375
```
7476
The `build` step can take 30 minutes and more.
7577

76-
Now you can `cargo build` miri, and you can `cargo test --tests`. (`--tests`
78+
Now you can `cargo build` Miri, and you can `cargo test --tests`. (`--tests`
7779
is needed to skip doctests because we have not built rustdoc for your custom
7880
toolchain.) You can also set `RUST_LOG=rustc_mir::interpret=trace` as
7981
environment variable to get a step-by-step trace.

0 commit comments

Comments
 (0)