Skip to content

Commit 86aa835

Browse files
committed
Work on miri installation and usage instructions
1 parent 1cbed5c commit 86aa835

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

README.md

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,23 @@ 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
11-
`rust-version` file describing the latest supported nightly version of the Rust
12-
compiler toolchain. Then all you have to do is:
10+
I recommend that you install [rustup][rustup] to obtain Rust. Then all you have
11+
to do is:
1312

1413
```sh
1514
cargo +nightly build
1615
```
1716

18-
with `+nightly` replaced with the appropriate nightly version of Rust.
17+
This uses the very latest Rust version. If you experience any problem, refer to
18+
the `rust-version` file which contains a particular Rust nightly version that
19+
has been tested against the version of miri you are using. Make sure to use
20+
that particular `nightly-YYYY-MM-DD` whenever the instructions just say
21+
`nightly`.
22+
23+
To avoid repeating the nightly version all the time, you can use
24+
`rustup override set nightly` (or `rustup override set nightly-YYYY-MM-DD`),
25+
which means `nightly` Rust will automatically be used whenever you are working
26+
in this directory.
1927

2028
## Running Miri
2129

@@ -41,18 +49,23 @@ Now you can run Miri against the libstd compiled by xargo:
4149
MIRI_SYSROOT=~/.xargo/HOST cargo +nightly run tests/run-pass-fullmir/hashmap.rs
4250
```
4351

44-
Notice that you will have to re-run the last step of the preparations above when
45-
your toolchain changes (e.g., when you update the nightly).
46-
47-
You can also set `-Zmiri-start-fn` to make Miri start evaluation with the
48-
`start_fn` lang item, instead of starting at the `main` function.
52+
Notice that you will have to re-run the last step of the preparations above
53+
(`xargo/build.sh`) when your toolchain changes (e.g., when you update the
54+
nightly).
4955

5056
## Running Miri on your own project('s test suite)
5157

52-
Install Miri as a cargo subcommand with `cargo install +nightly --all-features --path .`.
53-
54-
Compile your project and its dependencies against a MIR-enabled libstd as described
55-
above:
58+
Install Miri as a cargo subcommand with `cargo install +nightly --all-features
59+
--path .`. Be aware that if you used `rustup override set` to fix a particular
60+
Rust version for the miri directory, that will *not* apply to your own project
61+
directory! You have to use a consistent Rust version for building miri and your
62+
project for this to work, so remember to either always specify the nightly
63+
version manually, overriding it in your project directory as well, or use
64+
`rustup default nightly` (or `rustup default nightly-YYYY-MM-DD`) to globally
65+
make `nightly` the default toolchain.
66+
67+
We assume that you have prepared a MIR-enabled libstd as described above. Now
68+
compile your project and its dependencies against that libstd:
5669

5770
1. Run `cargo clean` to eliminate any cached dependencies that were built against
5871
the non-MIR `libstd`.

0 commit comments

Comments
 (0)