Skip to content

Commit 7b2e325

Browse files
committed
Auto merge of #1759 - RalfJung:readme, r=RalfJung
mention 'cargo miri test filter' in README Also update the "unsupported" example to something that is actually unsupported.
2 parents 685ad70 + a760aab commit 7b2e325

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,31 +83,32 @@ determine a nightly version that comes with Miri and install that using
8383

8484
Now you can run your project in Miri:
8585

86-
1. Run `cargo clean` to eliminate any cached dependencies. Miri needs your
86+
1. Run `cargo clean` to eliminate any cached dependencies. Miri needs your
8787
dependencies to be compiled the right way, that would not happen if they have
8888
previously already been compiled.
8989
2. To run all tests in your project through Miri, use `cargo miri test`.
9090
3. If you have a binary project, you can run it through Miri using `cargo miri run`.
9191

9292
The first time you run Miri, it will perform some extra setup and install some
93-
dependencies. It will ask you for confirmation before installing anything.
93+
dependencies. It will ask you for confirmation before installing anything.
9494

95-
`cargo miri run/test` supports the exact same flags as `cargo run/test`. You
96-
can pass arguments to Miri via `MIRIFLAGS`. For example,
95+
`cargo miri run/test` supports the exact same flags as `cargo run/test`. For
96+
example, `cargo miri test filter` only runs the tests containing `filter` in
97+
their name.
98+
99+
You can pass arguments to Miri via `MIRIFLAGS`. For example,
97100
`MIRIFLAGS="-Zmiri-disable-stacked-borrows" cargo miri run` runs the program
98101
without checking the aliasing of references.
99102

100-
When compiling code via `cargo miri`, the `cfg(miri)` config flag is set. You
103+
When compiling code via `cargo miri`, the `cfg(miri)` config flag is set. You
101104
can use this to ignore test cases that fail under Miri because they do things
102105
Miri does not support:
103106

104107
```rust
105108
#[test]
106109
#[cfg_attr(miri, ignore)]
107110
fn does_not_work_on_miri() {
108-
std::thread::spawn(|| println!("Hello Thread!"))
109-
.join()
110-
.unwrap();
111+
tokio::run(futures::future::ok::<_, ()>(()));
111112
}
112113
```
113114

@@ -126,11 +127,11 @@ error: unsupported operation: can't call foreign function: bind
126127
Miri can not only run a binary or test suite for your host target, it can also
127128
perform cross-interpretation for arbitrary foreign targets: `cargo miri run
128129
--target x86_64-unknown-linux-gnu` will run your program as if it was a Linux
129-
program, no matter your host OS. This is particularly useful if you are using
130+
program, no matter your host OS. This is particularly useful if you are using
130131
Windows, as the Linux target is much better supported than Windows targets.
131132

132133
You can also use this to test platforms with different properties than your host
133-
platform. For example `cargo miri test --target mips64-unknown-linux-gnuabi64`
134+
platform. For example `cargo miri test --target mips64-unknown-linux-gnuabi64`
134135
will run your test suite on a big-endian target, which is useful for testing
135136
endian-sensitive code.
136137

0 commit comments

Comments
 (0)