Skip to content

Commit 1062816

Browse files
committed
Auto merge of #853 - RalfJung:readme, r=RalfJung
readme: move flags and env vars up above dev
2 parents 7ef4097 + 59fa7c2 commit 1062816

File tree

1 file changed

+37
-36
lines changed

1 file changed

+37
-36
lines changed

README.md

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,43 @@ should never happen when you use `cargo miri` because that takes care of setting
136136
up the sysroot. If you are using `miri` (the Miri driver) directly, see
137137
[below][testing-miri] for how to set up the sysroot.
138138

139+
140+
## Miri `-Z` flags and environment variables
141+
[miri-flags]: #miri--z-flags-and-environment-variables
142+
143+
Several `-Z` flags are relevant for Miri:
144+
145+
* `-Zmiri-seed=<hex>` is a custom `-Z` flag added by Miri. It configures the
146+
seed of the RNG that Miri uses to resolve non-determinism. This RNG is used
147+
to pick base addresses for allocations, and when the interpreted program
148+
requests system entropy. The default seed is 0.
149+
**NOTE**: This entropy is not good enough for cryptographic use! Do not
150+
generate secret keys in Miri or perform other kinds of cryptographic
151+
operations that rely on proper random numbers.
152+
* `-Zmiri-disable-validation` disables enforcing the validity invariant, which
153+
is enforced by default. This is mostly useful for debugging; it means Miri
154+
will miss bugs in your program. However, this can also help to make Miri run
155+
faster.
156+
* `-Zmir-opt-level` controls how many MIR optimizations are performed. Miri
157+
overrides the default to be `0`; be advised that using any higher level can
158+
make Miri miss bugs in your program because they got optimized away.
159+
* `-Zalways-encode-mir` makes rustc dump MIR even for completely monomorphic
160+
functions. This is needed so that Miri can execute such functions, so Miri
161+
sets this flag per default.
162+
* `-Zmir-emit-retag` controls whether `Retag` statements are emitted. Miri
163+
enables this per default because it is needed for validation.
164+
165+
Moreover, Miri recognizes some environment variables:
166+
167+
* `MIRI_LOG`, `MIRI_BACKTRACE` control logging and backtrace printing during
168+
Miri executions, also [see above][testing-miri].
169+
* `MIRI_SYSROOT` (recognized by `cargo miri` and the test suite)
170+
indicates the sysroot to use. To do the same thing with `miri`
171+
directly, use the `--sysroot` flag.
172+
* `MIRI_TEST_TARGET` (recognized by the test suite) indicates which target
173+
architecture to test against. `miri` and `cargo miri` accept the `--target`
174+
flag for the same purpose.
175+
139176
## Development and Debugging
140177

141178
If you want to hack on miri yourself, great! Here are some resources you might
@@ -257,42 +294,6 @@ rustup override set custom
257294
With this, you should now have a working development setup! See
258295
[above][testing-miri] for how to proceed working with the Miri driver.
259296

260-
### Miri `-Z` flags and environment variables
261-
[miri-flags]: #miri--z-flags-and-environment-variables
262-
263-
Several `-Z` flags are relevant for Miri:
264-
265-
* `-Zmiri-seed=<hex>` is a custom `-Z` flag added by Miri. It configures the
266-
seed of the RNG that Miri uses to resolve non-determinism. This RNG is used
267-
to pick base addresses for allocations, and when the interpreted program
268-
requests system entropy. The default seed is 0.
269-
**NOTE**: This entropy is not good enough for cryptographic use! Do not
270-
generate secret keys in Miri or perform other kinds of cryptographic
271-
operations that rely on proper random numbers.
272-
* `-Zmiri-disable-validation` disables enforcing the validity invariant, which
273-
is enforced by default. This is mostly useful for debugging; it means Miri
274-
will miss bugs in your program. However, this can also help to make Miri run
275-
faster.
276-
* `-Zmir-opt-level` controls how many MIR optimizations are performed. Miri
277-
overrides the default to be `0`; be advised that using any higher level can
278-
make Miri miss bugs in your program because they got optimized away.
279-
* `-Zalways-encode-mir` makes rustc dump MIR even for completely monomorphic
280-
functions. This is needed so that Miri can execute such functions, so Miri
281-
sets this flag per default.
282-
* `-Zmir-emit-retag` controls whether `Retag` statements are emitted. Miri
283-
enables this per default because it is needed for validation.
284-
285-
Moreover, Miri recognizes some environment variables:
286-
287-
* `MIRI_LOG`, `MIRI_BACKTRACE` control logging and backtrace printing during
288-
Miri executions, also [see above][testing-miri].
289-
* `MIRI_SYSROOT` (recognized by `cargo miri` and the test suite)
290-
indicates the sysroot to use. To do the same thing with `miri`
291-
directly, use the `--sysroot` flag.
292-
* `MIRI_TEST_TARGET` (recognized by the test suite) indicates which target
293-
architecture to test against. `miri` and `cargo miri` accept the `--target`
294-
flag for the same purpose.
295-
296297
## Contributing and getting help
297298

298299
Check out the issues on this GitHub repository for some ideas. There's lots that

0 commit comments

Comments
 (0)