From 8c74325441c3d571f0439a772f9287ac94975f54 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 10 Mar 2019 17:53:30 +0100 Subject: [PATCH] mention --exclude-should-panic --- README.md | 4 ++-- src/bin/cargo-miri.rs | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index aef74d6a5fe6..184e37a894a9 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/bin/cargo-miri.rs b/src/bin/cargo-miri.rs index 0c90e8ade0d2..50570554f450 100644 --- a/src/bin/cargo-miri.rs +++ b/src/bin/cargo-miri.rs @@ -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")