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 ;
@@ -491,6 +491,7 @@ impl Builder<'_> {
491491 build_stamp:: clear_if_dirty ( self , & out_dir, & backend) ;
492492 }
493493
494+ let rustdoc_path = self . rustc ( compiler) . parent ( ) . unwrap ( ) . join ( "rustdoc" ) ;
494495 if cmd_kind == Kind :: Doc {
495496 let my_out = match mode {
496497 // This is the intended out directory for compiler documentation.
@@ -504,8 +505,7 @@ impl Builder<'_> {
504505 }
505506 _ => panic ! ( "doc mode {mode:?} not expected" ) ,
506507 } ;
507- let rustdoc = self . rustdoc ( compiler) ;
508- build_stamp:: clear_if_dirty ( self , & my_out, & rustdoc) ;
508+ build_stamp:: clear_if_dirty ( self , & my_out, & rustdoc_path) ;
509509 }
510510
511511 let profile_var = |name : & str | cargo_profile_var ( name, & self . config ) ;
@@ -801,11 +801,6 @@ impl Builder<'_> {
801801 build_stamp:: clear_if_dirty ( self , & out_dir, & self . rustc ( compiler) ) ;
802802 }
803803
804- let rustdoc_path = match cmd_kind {
805- Kind :: Doc | Kind :: Test | Kind :: MiriTest => self . rustdoc ( compiler) ,
806- _ => PathBuf :: from ( "/path/to/nowhere/rustdoc/not/required" ) ,
807- } ;
808-
809804 // Customize the compiler we're running. Specify the compiler to cargo
810805 // as our shim and then pass it some various options used to configure
811806 // how the actual compiler itself is called.
0 commit comments