1
Fork 0

add instructions for how to compile libstd with xargo

This commit is contained in:
Ralf Jung 2017-05-24 15:36:48 -07:00
parent ab90500d8c
commit 1ae01b422b
5 changed files with 34 additions and 0 deletions

View file

@ -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

4
xargo/Cargo.lock generated Normal file
View file

@ -0,0 +1,4 @@
[root]
name = "miri-xargo"
version = "0.0.0"

6
xargo/Cargo.toml Normal file
View file

@ -0,0 +1,6 @@
[package]
name = "miri-xargo"
description = "A dummy project for building libstd with xargo."
version = "0.0.0"
[dependencies]

2
xargo/Xargo.toml Normal file
View file

@ -0,0 +1,2 @@
[dependencies]
std = {features = ["panic_unwind", "jemalloc"]}

0
xargo/src/lib.rs Normal file
View file