11use std:: env;
22use std:: ffi:: { OsStr , OsString } ;
3- use std:: path:: { Path , PathBuf } ;
3+ use std:: path:: Path ;
44
55use super :: { Builder , Kind } ;
66use crate :: core:: build_steps:: tool:: SourceType ;
@@ -456,7 +456,7 @@ impl Builder<'_> {
456456 /// commands to be run with Miri.
457457 fn cargo (
458458 & self ,
459- compiler : Compiler ,
459+ mut compiler : Compiler ,
460460 mode : Mode ,
461461 source_type : SourceType ,
462462 target : TargetSelection ,
@@ -473,6 +473,7 @@ impl Builder<'_> {
473473 build_stamp:: clear_if_dirty ( self , & out_dir, & backend) ;
474474 }
475475
476+ let rustdoc_path = self . rustc ( compiler) . parent ( ) . unwrap ( ) . join ( "rustdoc" ) ;
476477 if cmd_kind == Kind :: Doc {
477478 let my_out = match mode {
478479 // This is the intended out directory for compiler documentation.
@@ -486,8 +487,7 @@ impl Builder<'_> {
486487 }
487488 _ => panic ! ( "doc mode {mode:?} not expected" ) ,
488489 } ;
489- let rustdoc = self . rustdoc ( compiler) ;
490- build_stamp:: clear_if_dirty ( self , & my_out, & rustdoc) ;
490+ build_stamp:: clear_if_dirty ( self , & my_out, & rustdoc_path) ;
491491 }
492492
493493 let profile_var = |name : & str | cargo_profile_var ( name, & self . config ) ;
@@ -779,11 +779,6 @@ impl Builder<'_> {
779779 build_stamp:: clear_if_dirty ( self , & out_dir, & self . rustc ( compiler) ) ;
780780 }
781781
782- let rustdoc_path = match cmd_kind {
783- Kind :: Doc | Kind :: Test | Kind :: MiriTest => self . rustdoc ( compiler) ,
784- _ => PathBuf :: from ( "/path/to/nowhere/rustdoc/not/required" ) ,
785- } ;
786-
787782 // Customize the compiler we're running. Specify the compiler to cargo
788783 // as our shim and then pass it some various options used to configure
789784 // how the actual compiler itself is called.
0 commit comments