File tree 3 files changed +14
-4
lines changed
bootstrap/src/core/build_steps
3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -680,9 +680,13 @@ impl Step for Miri {
680
680
. arg ( "--manifest-path" )
681
681
. arg ( builder. src . join ( "src/tools/miri/test-cargo-miri/Cargo.toml" ) ) ;
682
682
cargo. arg ( "--target" ) . arg ( target. rustc_target_arg ( ) ) ;
683
- cargo. arg ( "--tests" ) ; // don't run doctests, they are too confused by the staging
684
683
cargo. arg ( "--" ) . args ( builder. config . test_args ( ) ) ;
685
684
685
+ // `prepare_tool_cargo` sets RUSTDOC to the bootstrap wrapper and RUSTDOC_REAL to a dummy path as this is a "run", not a "test".
686
+ // Also, we want the rustdoc from the "next" stage for the same reason that we build a std from the next stage.
687
+ // So let's just set that here, and bypass bootstrap's RUSTDOC (just like cargo-miri already ignores bootstrap's RUSTC_WRAPPER).
688
+ cargo. env ( "RUSTDOC" , builder. rustdoc ( compiler_std) ) ;
689
+
686
690
// Tell `cargo miri` where to find things.
687
691
cargo. env ( "MIRI_SYSROOT" , & miri_sysroot) ;
688
692
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:
505
505
* `MIRI_LOCAL_CRATES` is set by `cargo-miri` to tell the Miri driver which
506
506
crates should be given special treatment in diagnostics, in addition to the
507
507
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.
508
510
* `MIRI_VERBOSE` when set to any value tells the various `cargo-miri` phases to
509
511
perform verbose logging.
510
512
* `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>) {
202
202
cmd. env ( "MIRI_BE_RUSTC" , "target" ) ; // we better remember to *unset* this in the other phases!
203
203
204
204
// Set rustdoc to us as well, so we can run doctests.
205
+ if let Some ( orig_rustdoc) = env:: var_os ( "RUSTDOC" ) {
206
+ cmd. env ( "MIRI_ORIG_RUSTDOC" , orig_rustdoc) ;
207
+ }
205
208
cmd. env ( "RUSTDOC" , & cargo_miri_path) ;
206
209
207
210
cmd. env ( "MIRI_LOCAL_CRATES" , local_crates ( & metadata) ) ;
@@ -581,9 +584,10 @@ pub fn phase_rustdoc(mut args: impl Iterator<Item = String>) {
581
584
let verbose = std:: env:: var ( "MIRI_VERBOSE" )
582
585
. map_or ( 0 , |verbose| verbose. parse ( ) . expect ( "verbosity flag must be an integer" ) ) ;
583
586
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) ;
587
591
588
592
let extern_flag = "--extern" ;
589
593
let runtool_flag = "--runtool" ;
You can’t perform that action at this time.
0 commit comments