File tree Expand file tree Collapse file tree 3 files changed +15
-5
lines changed
bootstrap/src/core/build_steps Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -680,9 +680,13 @@ impl Step for Miri {
680680 . arg ( "--manifest-path" )
681681 . arg ( builder. src . join ( "src/tools/miri/test-cargo-miri/Cargo.toml" ) ) ;
682682 cargo. arg ( "--target" ) . arg ( target. rustc_target_arg ( ) ) ;
683- cargo. arg ( "--tests" ) ; // don't run doctests, they are too confused by the staging
684- cargo. arg ( "--" ) . args ( builder. config . test_args ( ) ) ;
685683
684+ // `prepare_tool_cargo` sets RUSTDOC to the bootstrap wrapper and RUSTDOC_REAL to a dummy path as this is a "run", not a "test".
685+ // Also, we want the rustdoc from the "next" stage for the same reason that we build a std from the next stage.
686+ // So let's just set that here.
687+ cargo. env ( "RUSTDOC" , builder. rustdoc ( compiler_std) ) ;
688+
689+ cargo. arg ( "--" ) . args ( builder. config . test_args ( ) ) ;
686690 // Tell `cargo miri` where to find things.
687691 cargo. env ( "MIRI_SYSROOT" , & miri_sysroot) ;
688692 cargo. env ( "MIRI_HOST_SYSROOT" , sysroot) ;
Original file line number Diff line number Diff line change @@ -505,6 +505,8 @@ binaries, and as such worth documenting:
505505* `MIRI_LOCAL_CRATES` is set by `cargo-miri` to tell the Miri driver which
506506 crates should be given special treatment in diagnostics, in addition to the
507507 crate currently being compiled.
508+ * `MIRI_ORIG_RUSTDOC` is set and read by different phases of `cargo-miri` to remember the
509+ value of `RUSTDOC` from before it was overwritten.
508510* `MIRI_VERBOSE` when set to any value tells the various `cargo-miri` phases to
509511 perform verbose logging.
510512* `MIRI_HOST_SYSROOT` is set by bootstrap to tell `cargo-miri` which sysroot to use for *host*
Original file line number Diff line number Diff line change @@ -202,6 +202,9 @@ pub fn phase_cargo_miri(mut args: impl Iterator<Item = String>) {
202202 cmd. env ( "MIRI_BE_RUSTC" , "target" ) ; // we better remember to *unset* this in the other phases!
203203
204204 // Set rustdoc to us as well, so we can run doctests.
205+ if let Some ( old_rustdoc) = env:: var_os ( "RUSTDOC" ) {
206+ cmd. env ( "MIRI_ORIG_RUSTDOC" , old_rustdoc) ;
207+ }
205208 cmd. env ( "RUSTDOC" , & cargo_miri_path) ;
206209
207210 cmd. env ( "MIRI_LOCAL_CRATES" , local_crates ( & metadata) ) ;
@@ -581,9 +584,10 @@ pub fn phase_rustdoc(mut args: impl Iterator<Item = String>) {
581584 let verbose = std:: env:: var ( "MIRI_VERBOSE" )
582585 . map_or ( 0 , |verbose| verbose. parse ( ) . expect ( "verbosity flag must be an integer" ) ) ;
583586
584- // phase_cargo_miri sets the RUSTDOC env var to ourselves, so we can't use that here;
585- // just default to a straight-forward invocation for now:
586- let mut cmd = Command :: new ( "rustdoc" ) ;
587+ // phase_cargo_miri sets the RUSTDOC env var to ourselves, and puts a backup
588+ // of the old value into MIRI_ORIG_RUSTDOC. So that's what we have to invoke now.
589+ let rustdoc = env:: var ( "MIRI_ORIG_RUSTDOC" ) . unwrap_or ( "rustdoc" . to_string ( ) ) ;
590+ let mut cmd = Command :: new ( rustdoc) ;
587591
588592 let extern_flag = "--extern" ;
589593 let runtool_flag = "--runtool" ;
You can’t perform that action at this time.
0 commit comments