@@ -63,7 +63,7 @@ macro_rules! book {
6363 src: builder. src. join( $path) ,
6464 parent: Some ( self ) ,
6565 languages: $lang. into( ) ,
66- rustdoc : None ,
66+ rustdoc_compiler : None ,
6767 } )
6868 }
6969 }
@@ -113,7 +113,7 @@ impl Step for UnstableBook {
113113 src : builder. md_doc_out ( self . target ) . join ( "unstable-book" ) ,
114114 parent : Some ( self ) ,
115115 languages : vec ! [ ] ,
116- rustdoc : None ,
116+ rustdoc_compiler : None ,
117117 } )
118118 }
119119}
@@ -125,7 +125,7 @@ struct RustbookSrc<P: Step> {
125125 src : PathBuf ,
126126 parent : Option < P > ,
127127 languages : Vec < & ' static str > ,
128- rustdoc : Option < PathBuf > ,
128+ rustdoc_compiler : Option < Compiler > ,
129129}
130130
131131impl < P : Step > Step for RustbookSrc < P > {
@@ -157,14 +157,17 @@ impl<P: Step> Step for RustbookSrc<P> {
157157 let _ = fs:: remove_dir_all ( & out) ;
158158
159159 let mut rustbook_cmd = builder. tool_cmd ( Tool :: Rustbook ) ;
160- if let Some ( mut rustdoc) = self . rustdoc {
160+
161+ if let Some ( compiler) = self . rustdoc_compiler {
162+ let mut rustdoc = builder. rustdoc ( compiler) ;
161163 rustdoc. pop ( ) ;
162164 let old_path = env:: var_os ( "PATH" ) . unwrap_or_default ( ) ;
163165 let new_path =
164166 env:: join_paths ( std:: iter:: once ( rustdoc) . chain ( env:: split_paths ( & old_path) ) )
165167 . expect ( "could not add rustdoc to PATH" ) ;
166168
167169 rustbook_cmd. env ( "PATH" , new_path) ;
170+ builder. add_rustc_lib_path ( compiler, & mut rustbook_cmd) ;
168171 }
169172
170173 rustbook_cmd. arg ( "build" ) . arg ( & src) . arg ( "-d" ) . arg ( & out) . run ( builder) ;
@@ -240,7 +243,7 @@ impl Step for TheBook {
240243 src : absolute_path. clone ( ) ,
241244 parent : Some ( self ) ,
242245 languages : vec ! [ ] ,
243- rustdoc : None ,
246+ rustdoc_compiler : None ,
244247 } ) ;
245248
246249 // building older edition redirects
@@ -253,7 +256,7 @@ impl Step for TheBook {
253256 // treat the other editions as not having a parent.
254257 parent : Option :: < Self > :: None ,
255258 languages : vec ! [ ] ,
256- rustdoc : None ,
259+ rustdoc_compiler : None ,
257260 } ) ;
258261 }
259262
@@ -1218,7 +1221,7 @@ impl Step for RustcBook {
12181221 src : out_base,
12191222 parent : Some ( self ) ,
12201223 languages : vec ! [ ] ,
1221- rustdoc : None ,
1224+ rustdoc_compiler : None ,
12221225 } ) ;
12231226 }
12241227}
@@ -1252,16 +1255,15 @@ impl Step for Reference {
12521255 // This is needed for generating links to the standard library using
12531256 // the mdbook-spec plugin.
12541257 builder. ensure ( compile:: Std :: new ( self . compiler , builder. config . build ) ) ;
1255- let rustdoc = builder. rustdoc ( self . compiler ) ;
12561258
12571259 // Run rustbook/mdbook to generate the HTML pages.
12581260 builder. ensure ( RustbookSrc {
12591261 target : self . target ,
12601262 name : "reference" . to_owned ( ) ,
12611263 src : builder. src . join ( "src/doc/reference" ) ,
1264+ rustdoc_compiler : Some ( self . compiler ) ,
12621265 parent : Some ( self ) ,
12631266 languages : vec ! [ ] ,
1264- rustdoc : Some ( rustdoc) ,
12651267 } ) ;
12661268 }
12671269}
0 commit comments