Merge pull request #660 from rust-lang/readme

README: mention --exclude-should-panic
This commit is contained in:
Ralf Jung 2019-03-10 18:21:53 +01:00 committed by GitHub
commit e66d6ec58b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 7 deletions

View file

@ -61,8 +61,8 @@ You can pass arguments to Miri after the first `--`, and pass arguments to the
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

View file

@ -329,11 +329,8 @@ fn in_cargo_miri() {
"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()) {
@ -363,7 +360,8 @@ fn in_cargo_miri() {
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")