Skip to content

Commit df13ff9

Browse files
authored
Rollup merge of #137096 - ehuss:stabilize-doctest-xcompile, r=fmease
Stabilize flags for doctest cross compilation This makes the following changes in preparation for supporting doctest cross-compiling in cargo: - Renames `--runtool` and `--runtool-arg` to `--test-runtool` and `--test-runtool-arg` to maintain consistency with other `--test-*` arguments. - Stabilizes the `--test-runtool` and `--test-runtool-arg`. These are needed in order to support cargo's `target.runner` option which specifies a runner to execute a cross-compiled doctest (for example, qemu). - Stabilizes the `--enable-per-target-ignores` flag by removing it and making it unconditionally enabled. This makes it possible to disable a doctest on a per-target basis, which I think will be helpful for rolling out this feature. These changes were suggested in https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/stabilizing.20doctest.20xcompile/near/409281127 The intent is to stabilize the doctest-xcompile feature in cargo. This will help ensure that for projects that do cross-compile testing that their doctests are also covered. Currently there is a somewhat surprising behavior that they are ignored. Closes rust-lang/rust#64245 try-job: x86_64-msvc-1
2 parents b35714c + ebb9684 commit df13ff9

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

cargo-miri/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fn main() {
5353
// with `RustcPhase::Rustdoc`. There we perform a check-build (needed to get the expected
5454
// build failures for `compile_fail` doctests) and then store a JSON file with the
5555
// information needed to run this test.
56-
// - We also set `--runtool` to ourselves, which ends up in `phase_runner` with
56+
// - We also set `--test-runtool` to ourselves, which ends up in `phase_runner` with
5757
// `RunnerPhase::Rustdoc`. There we parse the JSON file written in `phase_rustc` and invoke
5858
// the Miri driver for interpretation.
5959

cargo-miri/src/phases.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -666,8 +666,8 @@ pub fn phase_rustdoc(mut args: impl Iterator<Item = String>) {
666666
if arg == "--extern" {
667667
// Patch --extern arguments to use *.rmeta files, since phase_cargo_rustc only creates stub *.rlib files.
668668
forward_patched_extern_arg(&mut args, &mut cmd);
669-
} else if arg == "--runtool" {
670-
// An existing --runtool flag indicates cargo is running in cross-target mode, which we don't support.
669+
} else if arg == "--test-runtool" {
670+
// An existing --test-runtool flag indicates cargo is running in cross-target mode, which we don't support.
671671
// Note that this is only passed when cargo is run with the unstable -Zdoctest-xcompile flag;
672672
// otherwise, we won't be called as rustdoc at all.
673673
show_error!("cross-interpreting doctests is not currently supported by Miri.");
@@ -693,8 +693,8 @@ pub fn phase_rustdoc(mut args: impl Iterator<Item = String>) {
693693
// to let phase_cargo_rustc know to expect that. We'll use this environment variable as a flag:
694694
cmd.env("MIRI_CALLED_FROM_RUSTDOC", "1");
695695

696-
// The `--test-builder` and `--runtool` arguments are unstable rustdoc features,
697-
// which are disabled by default. We first need to enable them explicitly:
696+
// The `--test-builder` is an unstable rustdoc features,
697+
// which is disabled by default. We first need to enable them explicitly:
698698
cmd.arg("-Zunstable-options");
699699

700700
// rustdoc needs to know the right sysroot.
@@ -705,7 +705,7 @@ pub fn phase_rustdoc(mut args: impl Iterator<Item = String>) {
705705
// Make rustdoc call us back.
706706
let cargo_miri_path = env::current_exe().expect("current executable path invalid");
707707
cmd.arg("--test-builder").arg(&cargo_miri_path); // invoked by forwarding most arguments
708-
cmd.arg("--runtool").arg(&cargo_miri_path); // invoked with just a single path argument
708+
cmd.arg("--test-runtool").arg(&cargo_miri_path); // invoked with just a single path argument
709709

710710
debug_cmd("[cargo-miri rustdoc]", verbose, &cmd);
711711
exec(cmd)

0 commit comments

Comments
 (0)