Skip to content

Commit 4bfecec

Browse files
committed
add instructions for how to compile libstd with xargo
1 parent 2764098 commit 4bfecec

File tree

5 files changed

+34
-0
lines changed

5 files changed

+34
-0
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,28 @@ Then, inside your own project, use `cargo +nightly miri` to run your project, if
5454
a bin project, or run `cargo +nightly miri test` to run all tests in your project
5555
through miri.
5656

57+
## Running miri with full libstd
58+
59+
Per default libstd does not contain the MIR of non-polymorphic functions. When
60+
miri hits a call to such a function, execution terminates. To fix this, it is
61+
possible to compile libstd with full MIR:
62+
63+
```sh
64+
cargo install xargo
65+
cd xargo/
66+
RUSTFLAGS='-Zalways-encode-mir' xargo build --target `rustc -vV | egrep '^host: ' | sed 's/^host: //'`
67+
```
68+
69+
Now you can run miri against the libstd compiled by xargo:
70+
71+
```sh
72+
cargo run --bin miri -- --sysroot ~/.xargo/HOST tests/run-pass/vecs.rs
73+
```
74+
75+
Notice that you will have to re-run the last step of the preparations above when
76+
your toolchain changes (e.g., when you update the nightly). Also, xargo doesn't
77+
currently work with nightlies newer than 2017-04-23.
78+
5779
## Contributing and getting help
5880

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

xargo/Cargo.lock

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

xargo/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[package]
2+
name = "miri-xargo"
3+
description = "A dummy project for building libstd with xargo."
4+
version = "0.0.0"
5+
6+
[dependencies]

xargo/Xargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[dependencies]
2+
std = {features = ["panic_unwind", "jemalloc"]}

xargo/src/lib.rs

Whitespace-only changes.

0 commit comments

Comments
 (0)