]> git.lizzy.rs Git - rust.git/blobdiff - README.md
Merge pull request #766 from RalfJung/sysroot
[rust.git] / README.md
index ae2f5f506f16ff3a1c328dccbc04d9e7b28772c1..090694128e3ae047ead08649b0381d86f38bf524 100644 (file)
--- a/README.md
+++ b/README.md
@@ -141,42 +141,30 @@ version of `rustc` that, instead of compiling your code, runs it.  It accepts
 all the same flags as `rustc` (though the ones only affecting code generation
 and linking obviously will have no effect) [and more][miri-flags].
 
-To run the Miri driver, you need to have the `MIRI_SYSROOT` environment variable
-set to an appropriate sysroot.  You can generate such a sysroot with the
-following incantation:
-
-```
-cargo run --bin cargo-miri -- miri setup
-```
-
-This basically runs the `cargo-miri` binary (which backs the `cargo miri`
-subcommand) with `cargo`, and asks it to `setup`.  It should in the end print
-the directory where the libstd was built.  In the following, we will assume it
-is `~/.cache/miri/HOST`; you may have to adjust that if you are not using Linux.
-
-Now you can run the driver directly using
+Running the Miri driver requires some fiddling with environment variables, so
+the `miri` script helps you do that.  For example, you can run the driver on a
+particular file by doing
 
 ```sh
-MIRI_SYSROOT=~/.cache/miri/HOST cargo run tests/run-pass/format.rs # or whatever test you like
+./miri run tests/run-pass/format.rs
+./miri run tests/run-pass/hello.rs --target i686-unknown-linux-gnu
 ```
 
-and you can run the test suite using
+and you can run the test suite using:
 
 ```
-cargo test
+./miri test
 ```
 
-We recommend adding the `--release` flag to make tests run faster.
-
-`cargo test --release FILTER` only runs those tests that contain `FILTER` in
-their filename (including the base directory, e.g. `cargo test --release fail`
-will run all compile-fail tests).
+`./miri test FILTER` only runs those tests that contain `FILTER` in their
+filename (including the base directory, e.g. `./miri test fail` will run all
+compile-fail tests).
 
 You can get a trace of which MIR statements are being executed by setting the
 `MIRI_LOG` environment variable.  For example:
 
 ```sh
-MIRI_LOG=info cargo run tests/run-pass/vecs.rs
+MIRI_LOG=info ./miri run tests/run-pass/vecs.rs
 ```
 
 Setting `MIRI_LOG` like this will configure logging for Miri itself as well as
@@ -185,7 +173,7 @@ can also do more targeted configuration, e.g. the following helps debug the
 stacked borrows implementation:
 
 ```sh
-MIRI_LOG=rustc_mir::interpret=info,miri::stacked_borrows cargo run tests/run-pass/vecs.rs
+MIRI_LOG=rustc_mir::interpret=info,miri::stacked_borrows ./miri run tests/run-pass/vecs.rs
 ```
 
 In addition, you can set `MIRI_BACKTRACE=1` to get a backtrace of where an
@@ -199,7 +187,7 @@ is probably easier to test it with the cargo wrapper.  You can install your
 development version of Miri using
 
 ```
-cargo install --path . --force
+./miri install
 ```
 
 and then you can use it as if it was installed by `rustup`.  Make sure you use
@@ -235,18 +223,7 @@ rustup override set custom
 ```
 
 With this, you should now have a working development setup!  See
-[above][testing-miri] for how to proceed working with the Miri driver.  Notice
-that rustc's sysroot is already built for Miri in this case, so you can set
-`MIRI_SYSROOT=$(rustc --print sysroot)`.
-
-Running `cargo miri` in this setup is a bit more complicated, because the Miri
-binary you just created needs help to find the libraries it links against.  On
-Linux, you can set the rpath to make this "just work":
-
-```sh
-export RUSTFLAGS="-C link-args=-Wl,-rpath,$(rustc --print sysroot)/lib/rustlib/x86_64-unknown-linux-gnu/lib"
-cargo install --path . --force
-```
+[above][testing-miri] for how to proceed working with the Miri driver.
 
 ### Miri `-Z` flags and environment variables
 [miri-flags]: #miri--z-flags-and-environment-variables
@@ -273,9 +250,12 @@ Several `-Z` flags are relevant for Miri:
 
 Moreover, Miri recognizes some environment variables:
 
-* `MIRI_SYSROOT` (recognized by `miri`, `cargo miri` and the test suite)
-  indicates the sysroot to use.
-* `MIRI_TARGET` (recognized by the test suite) indicates which target
+* `MIRI_LOG`, `MIRI_BACKTRACE` control logging and backtrace printing during
+  Miri executions, also [see above][testing-miri].
+* `MIRI_SYSROOT` (recognized by `cargo miri` and the test suite)
+  indicates the sysroot to use.  To do the same thing with `miri`
+  directly, use the `--sysroot` flag.
+* `MIRI_TEST_TARGET` (recognized by the test suite) indicates which target
   architecture to test against.  `miri` and `cargo miri` accept the `--target`
   flag for the same purpose.
 
@@ -317,6 +297,7 @@ Definite bugs found:
 * [`Debug for vec_deque::Iter` accessing uninitialized memory](https://github.com/rust-lang/rust/issues/53566)
 * [`From<&[T]> for Rc` creating a not sufficiently aligned reference](https://github.com/rust-lang/rust/issues/54908)
 * [`BTreeMap` creating a shared reference pointing to a too small allocation](https://github.com/rust-lang/rust/issues/54957)
+* [`Vec::append` creating a dangling reference](https://github.com/rust-lang/rust/pull/61082)
 * [Futures turning a shared reference into a mutable one](https://github.com/rust-lang/rust/pull/56319)
 * [`str` turning a shared reference into a mutable one](https://github.com/rust-lang/rust/pull/58200)
 * [`rand` performing unaligned reads](https://github.com/rust-random/rand/issues/779)
@@ -326,6 +307,7 @@ Violations of Stacked Borrows found that are likely bugs (but Stacked Borrows is
 * [`VecDeque` creating overlapping mutable references](https://github.com/rust-lang/rust/pull/56161)
 * [`BTreeMap` creating mutable references that overlap with shared references](https://github.com/rust-lang/rust/pull/58431)
 * [`LinkedList` creating overlapping mutable references](https://github.com/rust-lang/rust/pull/60072)
+* [`Vec::push` invalidating existing references into the vector](https://github.com/rust-lang/rust/issues/60847)
 
 ## License