@@ -176,6 +176,11 @@ pub fn phase_cargo_miri(mut args: impl Iterator<Item = String>) {
176
176
// Set `--target-dir` to `miri` inside the original target directory.
177
177
let target_dir = get_target_dir ( & metadata) ;
178
178
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
+ }
179
184
180
185
// *After* we set all the flags that need setting, forward everything else. Make sure to skip
181
186
// `--target-dir` (which would otherwise be set twice).
@@ -666,11 +671,6 @@ pub fn phase_rustdoc(mut args: impl Iterator<Item = String>) {
666
671
if arg == "--extern" {
667
672
// Patch --extern arguments to use *.rmeta files, since phase_cargo_rustc only creates stub *.rlib files.
668
673
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." ) ;
674
674
} else {
675
675
cmd. arg ( arg) ;
676
676
}
@@ -702,10 +702,10 @@ pub fn phase_rustdoc(mut args: impl Iterator<Item = String>) {
702
702
// make sure the 'miri' flag is set for rustdoc
703
703
cmd. arg ( "--cfg" ) . arg ( "miri" ) ;
704
704
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.)
706
707
let cargo_miri_path = env:: current_exe ( ) . expect ( "current executable path invalid" ) ;
707
708
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
709
709
710
710
debug_cmd ( "[cargo-miri rustdoc]" , verbose, & cmd) ;
711
711
exec ( cmd)
0 commit comments