@@ -176,6 +176,11 @@ pub fn phase_cargo_miri(mut args: impl Iterator<Item = String>) {
176176 // Set `--target-dir` to `miri` inside the original target directory.
177177 let target_dir = get_target_dir ( & metadata) ;
178178 cmd. arg ( "--target-dir" ) . arg ( target_dir) ;
179+ // Only when running in x.py (where we are running with beta cargo): set `RUSTC_STAGE`.
180+ // Will have to be removed on next bootstrap bump. tag: cfg(bootstrap).
181+ if env:: var_os ( "RUSTC_STAGE" ) . is_some ( ) {
182+ cmd. arg ( "-Zdoctest-xcompile" ) ;
183+ }
179184
180185 // *After* we set all the flags that need setting, forward everything else. Make sure to skip
181186 // `--target-dir` (which would otherwise be set twice).
@@ -666,11 +671,6 @@ pub fn phase_rustdoc(mut args: impl Iterator<Item = String>) {
666671 if arg == "--extern" {
667672 // Patch --extern arguments to use *.rmeta files, since phase_cargo_rustc only creates stub *.rlib files.
668673 forward_patched_extern_arg ( & mut args, & mut cmd) ;
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.
671- // Note that this is only passed when cargo is run with the unstable -Zdoctest-xcompile flag;
672- // otherwise, we won't be called as rustdoc at all.
673- show_error ! ( "cross-interpreting doctests is not currently supported by Miri." ) ;
674674 } else {
675675 cmd. arg ( arg) ;
676676 }
@@ -702,10 +702,10 @@ pub fn phase_rustdoc(mut args: impl Iterator<Item = String>) {
702702 // make sure the 'miri' flag is set for rustdoc
703703 cmd. arg ( "--cfg" ) . arg ( "miri" ) ;
704704
705- // Make rustdoc call us back.
705+ // Make rustdoc call us back for the build.
706+ // (cargo already sets `--test-runtool` to us since we are the cargo test runner.)
706707 let cargo_miri_path = env:: current_exe ( ) . expect ( "current executable path invalid" ) ;
707708 cmd. arg ( "--test-builder" ) . arg ( & cargo_miri_path) ; // invoked by forwarding most arguments
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