]> git.lizzy.rs Git - rust.git/commitdiff
document the cargo-miri feature
authorRalf Jung <post@ralfj.de>
Wed, 19 Dec 2018 10:16:19 +0000 (11:16 +0100)
committerRalf Jung <post@ralfj.de>
Wed, 19 Dec 2018 10:16:19 +0000 (11:16 +0100)
README.md

index 02e13ad56a7ed4923164c587af919b548d835485..5a615e656d7428bfe97cb19c67638798175db5da 100644 (file)
--- a/README.md
+++ b/README.md
@@ -39,7 +39,7 @@ example above), overriding it in your project directory as well, or use `rustup
 default nightly` (or `rustup default nightly-YYYY-MM-DD`) to globally make
 `nightly` the default toolchain.
 
-Now you can run your project in miri:
+Now you can run your project in Miri:
 
 1. Run `cargo clean` to eliminate any cached dependencies.  Miri needs your
    dependencies to be compiled the right way, that would not happen if they have
@@ -48,6 +48,19 @@ Now you can run your project in miri:
 3. If you have a binary project, you can run it through Miri using `cargo
    +nightly miri run`.
 
+When running code via `cargo miri`, the `cargo-miri` feature is set.  You can
+use this to exclude test cases that will fail under Miri because they do things
+Miri does not support:
+
+```rust
+#[cfg(not(feature = "cargo-miri"))]
+#[test]
+fn does_not_work_on_miri() {
+    let x = 0u8;
+    assert!(&x as *const _ as usize % 4 < 4);
+}
+```
+
 ### Common Problems
 
 When using the above instructions, you may encounter a number of confusing compiler