diff --git a/README.md b/README.md index aa8e0315b76..aa89df9731f 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,28 @@ Then, inside your own project, use `cargo +nightly miri` to run your project, if a bin project, or run `cargo +nightly miri test` to run all tests in your project through miri. +## Running miri with full libstd + +Per default libstd does not contain the MIR of non-polymorphic functions. When +miri hits a call to such a function, execution terminates. To fix this, it is +possible to compile libstd with full MIR: + +```sh +cargo install xargo +cd xargo/ +RUSTFLAGS='-Zalways-encode-mir' xargo build --target `rustc -vV | egrep '^host: ' | sed 's/^host: //'` +``` + +Now you can run miri against the libstd compiled by xargo: + +```sh +cargo run --bin miri -- --sysroot ~/.xargo/HOST tests/run-pass/vecs.rs +``` + +Notice that you will have to re-run the last step of the preparations above when +your toolchain changes (e.g., when you update the nightly). Also, xargo doesn't +currently work with nightlies newer than 2017-04-23. + ## Contributing and getting help Check out the issues on this GitHub repository for some ideas. There's lots that diff --git a/xargo/Cargo.lock b/xargo/Cargo.lock new file mode 100644 index 00000000000..031ad9a8795 --- /dev/null +++ b/xargo/Cargo.lock @@ -0,0 +1,4 @@ +[root] +name = "miri-xargo" +version = "0.0.0" + diff --git a/xargo/Cargo.toml b/xargo/Cargo.toml new file mode 100644 index 00000000000..9129c105b11 --- /dev/null +++ b/xargo/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "miri-xargo" +description = "A dummy project for building libstd with xargo." +version = "0.0.0" + +[dependencies] diff --git a/xargo/Xargo.toml b/xargo/Xargo.toml new file mode 100644 index 00000000000..32f45c4a981 --- /dev/null +++ b/xargo/Xargo.toml @@ -0,0 +1,2 @@ +[dependencies] +std = {features = ["panic_unwind", "jemalloc"]} diff --git a/xargo/src/lib.rs b/xargo/src/lib.rs new file mode 100644 index 00000000000..e69de29bb2d