Skip to content

Commit f9bd6b0

Browse files
committed
nits; test running no doctests
1 parent e66a89c commit f9bd6b0

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

cargo-miri/bin.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,7 @@ fn phase_cargo_rustc(mut args: env::Args) {
683683
let mut cmd = miri();
684684

685685
// Ensure --emit argument for a check-only build is present.
686+
// We cannot use the usual helpers since we need to check specifically in `env.args`.
686687
if let Some(i) = env.args.iter().position(|arg| arg.starts_with("--emit=")) {
687688
// For `no_run` tests, rustdoc passes a `--emit` flag; make sure it has the right shape.
688689
assert_eq!(env.args[i], "--emit=metadata");
@@ -877,7 +878,7 @@ fn phase_cargo_rustdoc(fst_arg: &str, mut args: env::Args) {
877878

878879
// phase_cargo_miri sets the RUSTDOC env var to ourselves, so we can't use that here;
879880
// just default to a straight-forward invocation for now:
880-
let mut cmd = Command::new(OsString::from("rustdoc"));
881+
let mut cmd = Command::new("rustdoc");
881882

882883
// Because of the way the main function is structured, we have to take the first argument spearately
883884
// from the rest; to simplify the following argument patching loop, we'll just skip that one.
@@ -888,6 +889,7 @@ fn phase_cargo_rustdoc(fst_arg: &str, mut args: env::Args) {
888889
cmd.arg(fst_arg);
889890

890891
let runtool_flag = "--runtool";
892+
// `crossmode` records if *any* argument matches `runtool_flag`; here we check the first one.
891893
let mut crossmode = fst_arg == runtool_flag;
892894
while let Some(arg) = args.next() {
893895
if arg == extern_flag {
@@ -950,9 +952,8 @@ fn main() {
950952
return;
951953
}
952954

953-
// The way rustdoc invokes rustc is indistuingishable from the way cargo invokes rustdoc
954-
// by the arguments alone, and we can't take from the args iterator in this case.
955-
// phase_cargo_rustdoc sets this environment variable to let us disambiguate here
955+
// The way rustdoc invokes rustc is indistuingishable from the way cargo invokes rustdoc by the
956+
// arguments alone. `phase_cargo_rustdoc` sets this environment variable to let us disambiguate.
956957
let invoked_by_rustdoc = env::var_os("MIRI_CALLED_FROM_RUSTDOC").is_some();
957958
if invoked_by_rustdoc {
958959
// ...however, we then also see this variable when rustdoc invokes us as the testrunner!

test-cargo-miri/run-test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ def test_cargo_miri_test():
113113
default_ref, "test.stderr-empty.ref",
114114
env={'MIRIFLAGS': "-Zmiri-seed=feed"},
115115
)
116-
test("`cargo miri test` (no isolation)",
117-
cargo_miri("test"),
118-
default_ref, "test.stderr-empty.ref",
116+
test("`cargo miri test` (no isolation, no doctests)",
117+
cargo_miri("test") + ["--bins", "--tests"], # no `--lib`, we disabled that in `Cargo.toml`
118+
"test.cross-target.stdout.ref", "test.stderr-empty.ref",
119119
env={'MIRIFLAGS': "-Zmiri-disable-isolation"},
120120
)
121121
test("`cargo miri test` (raw-ptr tracking)",

0 commit comments

Comments
 (0)