Skip to content

Commit 46cdac0

Browse files
committed
Auto merge of #3641 - RalfJung:env-vars, r=RalfJung
move ./miri environment variables to CONTRIBUTING The README should discuss `cargo miri`, i.e. what users usually use, not the developer-only `./miri`.
2 parents 6cd3641 + 38366c2 commit 46cdac0

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

CONTRIBUTING.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,22 @@ https. Add the following to your `.gitconfig`:
287287
pushInsteadOf = https://github.com/
288288
```
289289

290-
## Internal environment variables
290+
## Further environment variables
291+
292+
The following environment variables are relevant to `./miri`:
293+
294+
* `MIRI_AUTO_OPS` indicates whether the automatic execution of rustfmt, clippy and toolchain setup
295+
(as controlled by the `./auto-*` files) should be skipped. If it is set to `no`, they are skipped.
296+
This is used to allow automated IDE actions to avoid the auto ops.
297+
* `MIRI_LOG`, `MIRI_BACKTRACE` control logging and backtrace printing during Miri executions.
298+
* `MIRI_TEST_THREADS` (recognized by `./miri test`) sets the number of threads to use for running
299+
tests. By default, the number of cores is used.
300+
* `MIRI_SKIP_UI_CHECKS` (recognized by `./miri test`) disables checking that the `stderr` or
301+
`stdout` files match the actual output.
302+
303+
Furthermore, the usual environment variables recognized by `cargo miri` also work for `./miri`, e.g.
304+
`MIRI_LIB_SRC`. Note that `MIRIFLAGS` is ignored by `./miri test` as each test controls the flags it
305+
is run with.
291306

292307
The following environment variables are *internal* and must not be used by
293308
anyone but Miri itself. They are used to communicate between different Miri

README.md

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -448,28 +448,19 @@ Some native rustc `-Z` flags are also very relevant for Miri:
448448
* `-Zmir-emit-retag` controls whether `Retag` statements are emitted. Miri
449449
enables this per default because it is needed for [Stacked Borrows] and [Tree Borrows].
450450

451-
Moreover, Miri recognizes some environment variables (unless noted otherwise, these are supported
452-
by all intended entry points, i.e. `cargo miri` and `./miri {test,run}`):
453-
454-
* `MIRI_AUTO_OPS` indicates whether the automatic execution of rustfmt, clippy and toolchain setup
455-
should be skipped. If it is set to `no`, they are skipped. This is used to allow automated IDE
456-
actions to avoid the auto ops.
457-
* `MIRI_LOG`, `MIRI_BACKTRACE` control logging and backtrace printing during
458-
Miri executions, also [see "Testing the Miri driver" in `CONTRIBUTING.md`][testing-miri].
451+
Moreover, Miri recognizes some environment variables:
452+
459453
* `MIRIFLAGS` defines extra flags to be passed to Miri.
460454
* `MIRI_LIB_SRC` defines the directory where Miri expects the sources of the standard library that
461455
it will build and use for interpretation. This directory must point to the `library` subdirectory
462456
of a `rust-lang/rust` repository checkout.
463-
* `MIRI_SYSROOT` indicates the sysroot to use. When using `cargo miri`, this skips the automatic
457+
* `MIRI_SYSROOT` indicates the sysroot to use. When using `cargo miri test`/`cargo miri run`, this skips the automatic
464458
setup -- only set this if you do not want to use the automatically created sysroot. When invoking
465459
`cargo miri setup`, this indicates where the sysroot will be put.
466-
* `MIRI_TEST_THREADS` (recognized by `./miri test`): set the number of threads to use for running tests.
467-
By default, the number of cores is used.
468460
* `MIRI_NO_STD` makes sure that the target's sysroot is built without libstd. This allows testing
469-
and running no_std programs. (Miri has a heuristic to detect no-std targets based on the target
470-
name; this environment variable is only needed when that heuristic fails.)
471-
* `MIRI_SKIP_UI_CHECKS` (recognized by `./miri test`): don't check whether the
472-
`stderr` or `stdout` files match the actual output.
461+
and running no_std programs. This should *not usually be used*; Miri has a heuristic to detect
462+
no-std targets based on the target name. Setting this on a target that does support libstd can
463+
lead to confusing results.
473464

474465
[testing-miri]: CONTRIBUTING.md#testing-the-miri-driver
475466

0 commit comments

Comments
 (0)