interpreted program or test suite after the second `--`. For example, `cargo
+nightly miri run -- -Zmiri-disable-validation` runs the program without
validation of basic type invariants and references. `cargo +nightly miri test
--- -- filter` passes `filter` to the test suite the same way `cargo test filter`
-would.
+-- -- -Zunstable-options --exclude-should-panic` skips `#[should_panic]` tests,
+which is a good idea because Miri does not support unwinding or catching panics.
When running code via `cargo miri`, the `miri` config flag is set. You can
use this to exclude test cases that will fail under Miri because they do things
"badly formatted cargo metadata: target::kind is an empty array",
);
// Now we run `cargo rustc $FLAGS $ARGS`, giving the user the
- // change to add additional flags. `FLAGS` is set to identify
+ // change to add additional arguments. `FLAGS` is set to identify
// this target. The user gets to control what gets actually passed to Miri.
- // However, we need to add a flag to what gets passed to rustc for the finaly
- // binary, so that we know to interpret that with Miri.
- // So after the first `--`, we add `-Zcargo-miri-marker`.
let mut cmd = Command::new("cargo");
cmd.arg("rustc");
match (subcommand, kind.as_str()) {
cmd.arg(arg);
}
// Add `--` (to end the `cargo` flags), and then the user flags. We add markers around the
- // user flags to be able to identify them later.
+ // user flags to be able to identify them later. "cargo rustc" adds more stuff after this,
+ // so we have to mark both the beginning and the end.
cmd
.arg("--")
.arg("cargo-miri-marker-begin")