Skip to content

Commit 8b29e57

Browse files
committed
Enable doc-tests in cross-mode tests
1 parent 10115cd commit 8b29e57

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

cargo-miri/bin.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,13 +819,17 @@ fn phase_cargo_rustdoc(fst_arg: &str, mut args: env::Args) {
819819
// This is fine for now, because cargo will never pass an --extern argument in the first position,
820820
// but we should defensively assert that this will work.
821821
let extern_flag = "--extern";
822+
let runtool_flag = "--runtool";
822823
assert!(fst_arg != extern_flag);
823824
cmd.arg(fst_arg);
824825

825-
// Patch --extern arguments to use *.rmeta files, since phase_cargo_rustc only creates stub *.rlib files.
826826
while let Some(arg) = args.next() {
827827
if arg == extern_flag {
828+
// Patch --extern arguments to use *.rmeta files, since phase_cargo_rustc only creates stub *.rlib files.
828829
try_forward_patched_extern_arg(&mut args, &mut cmd);
830+
} else if arg == runtool_flag {
831+
// Do not forward an existing --runtool argument, since we will set this ourselves
832+
let _ = args.next().expect("`--runtool` should be followed by an executable name");
829833
} else {
830834
cmd.arg(arg);
831835
}

test-cargo-miri/run-test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def cargo_miri(cmd):
1919
args = ["cargo", "miri", cmd, "-q"]
2020
if 'MIRI_TEST_TARGET' in os.environ:
2121
args += ["--target", os.environ['MIRI_TEST_TARGET']]
22+
args += ["-Zdoctest-xcompile"]
2223
return args
2324

2425
def normalize_stdout(str):

0 commit comments

Comments
 (0)