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,8 @@ impl Builder<'_> {
491491 build_stamp:: clear_if_dirty ( self , & out_dir, & backend) ;
492492 }
493493
494+ // RUSTC AND TOOL DOWNGRADES MISMATCH
495+ let rustdoc_path = self . rustc ( compiler) . parent ( ) . unwrap ( ) . join ( "rustdoc" ) ;
494496 if cmd_kind == Kind :: Doc {
495497 let my_out = match mode {
496498 // This is the intended out directory for compiler documentation.
@@ -504,8 +506,7 @@ impl Builder<'_> {
504506 }
505507 _ => panic ! ( "doc mode {mode:?} not expected" ) ,
506508 } ;
507- let rustdoc = self . rustdoc ( compiler) ;
508- build_stamp:: clear_if_dirty ( self , & my_out, & rustdoc) ;
509+ build_stamp:: clear_if_dirty ( self , & my_out, & rustdoc_path) ;
509510 }
510511
511512 let profile_var = |name : & str | cargo_profile_var ( name, & self . config ) ;
@@ -801,11 +802,6 @@ impl Builder<'_> {
801802 build_stamp:: clear_if_dirty ( self , & out_dir, & self . rustc ( compiler) ) ;
802803 }
803804
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-
809805 // Customize the compiler we're running. Specify the compiler to cargo
810806 // as our shim and then pass it some various options used to configure
811807 // how the actual compiler itself is called.
0 commit comments