@@ -49,7 +49,7 @@ macro_rules! book {
4949 builder. ensure( RustbookSrc {
5050 target: self . target,
5151 name: INTERNER . intern_str( $book_name) ,
52- src: doc_src ( builder) ,
52+ src: INTERNER . intern_path ( builder. src . join ( $path ) ) ,
5353 } )
5454 }
5555 }
@@ -60,6 +60,7 @@ macro_rules! book {
6060// NOTE: When adding a book here, make sure to ALSO build the book by
6161// adding a build step in `src/bootstrap/builder.rs`!
6262book ! (
63+ CargoBook , "src/tools/cargo/src/doc" , "cargo" ;
6364 EditionGuide , "src/doc/edition-guide" , "edition-guide" ;
6465 EmbeddedBook , "src/doc/embedded-book" , "embedded-book" ;
6566 Nomicon , "src/doc/nomicon" , "nomicon" ;
@@ -69,10 +70,6 @@ book!(
6970 RustdocBook , "src/doc/rustdoc" , "rustdoc" ;
7071) ;
7172
72- fn doc_src ( builder : & Builder < ' _ > ) -> Interned < PathBuf > {
73- INTERNER . intern_path ( builder. src . join ( "src/doc" ) )
74- }
75-
7673#[ derive( Debug , Copy , Clone , Hash , PartialEq , Eq ) ]
7774pub struct UnstableBook {
7875 target : Interned < String > ,
@@ -96,48 +93,11 @@ impl Step for UnstableBook {
9693 builder. ensure ( RustbookSrc {
9794 target : self . target ,
9895 name : INTERNER . intern_str ( "unstable-book" ) ,
99- src : builder. md_doc_out ( self . target ) ,
96+ src : INTERNER . intern_path ( builder. md_doc_out ( self . target ) . join ( "unstable-book" ) ) ,
10097 } )
10198 }
10299}
103100
104- #[ derive( Debug , Copy , Clone , Hash , PartialEq , Eq ) ]
105- pub struct CargoBook {
106- target : Interned < String > ,
107- name : Interned < String > ,
108- }
109-
110- impl Step for CargoBook {
111- type Output = ( ) ;
112- const DEFAULT : bool = true ;
113-
114- fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
115- let builder = run. builder ;
116- run. path ( "src/tools/cargo/src/doc/book" ) . default_condition ( builder. config . docs )
117- }
118-
119- fn make_run ( run : RunConfig < ' _ > ) {
120- run. builder . ensure ( CargoBook { target : run. target , name : INTERNER . intern_str ( "cargo" ) } ) ;
121- }
122-
123- fn run ( self , builder : & Builder < ' _ > ) {
124- let target = self . target ;
125- let name = self . name ;
126- let src = builder. src . join ( "src/tools/cargo/src/doc" ) ;
127-
128- let out = builder. doc_out ( target) ;
129- t ! ( fs:: create_dir_all( & out) ) ;
130-
131- let out = out. join ( name) ;
132-
133- builder. info ( & format ! ( "Cargo Book ({}) - {}" , target, name) ) ;
134-
135- let _ = fs:: remove_dir_all ( & out) ;
136-
137- builder. run ( builder. tool_cmd ( Tool :: Rustbook ) . arg ( "build" ) . arg ( & src) . arg ( "-d" ) . arg ( out) ) ;
138- }
139- }
140-
141101#[ derive( Debug , Copy , Clone , Hash , PartialEq , Eq ) ]
142102struct RustbookSrc {
143103 target : Interned < String > ,
@@ -164,7 +124,6 @@ impl Step for RustbookSrc {
164124 t ! ( fs:: create_dir_all( & out) ) ;
165125
166126 let out = out. join ( name) ;
167- let src = src. join ( name) ;
168127 let index = out. join ( "index.html" ) ;
169128 let rustbook = builder. tool_exe ( Tool :: Rustbook ) ;
170129 let mut rustbook_cmd = builder. tool_cmd ( Tool :: Rustbook ) ;
@@ -182,7 +141,6 @@ impl Step for RustbookSrc {
182141pub struct TheBook {
183142 compiler : Compiler ,
184143 target : Interned < String > ,
185- name : & ' static str ,
186144}
187145
188146impl Step for TheBook {
@@ -198,53 +156,37 @@ impl Step for TheBook {
198156 run. builder . ensure ( TheBook {
199157 compiler : run. builder . compiler ( run. builder . top_stage , run. builder . config . build ) ,
200158 target : run. target ,
201- name : "book" ,
202159 } ) ;
203160 }
204161
205162 /// Builds the book and associated stuff.
206163 ///
207164 /// We need to build:
208165 ///
209- /// * Book (first edition)
210- /// * Book (second edition)
166+ /// * Book
167+ /// * Older edition redirects
211168 /// * Version info and CSS
212169 /// * Index page
213170 /// * Redirect pages
214171 fn run ( self , builder : & Builder < ' _ > ) {
215172 let compiler = self . compiler ;
216173 let target = self . target ;
217- let name = self . name ;
218174
219175 // build book
220176 builder. ensure ( RustbookSrc {
221177 target,
222- name : INTERNER . intern_string ( name . to_string ( ) ) ,
223- src : doc_src ( builder) ,
178+ name : INTERNER . intern_str ( "book" ) ,
179+ src : INTERNER . intern_path ( builder. src . join ( "src/doc/book" ) ) ,
224180 } ) ;
225181
226182 // building older edition redirects
227-
228- let source_name = format ! ( "{}/first-edition" , name) ;
229- builder. ensure ( RustbookSrc {
230- target,
231- name : INTERNER . intern_string ( source_name) ,
232- src : doc_src ( builder) ,
233- } ) ;
234-
235- let source_name = format ! ( "{}/second-edition" , name) ;
236- builder. ensure ( RustbookSrc {
237- target,
238- name : INTERNER . intern_string ( source_name) ,
239- src : doc_src ( builder) ,
240- } ) ;
241-
242- let source_name = format ! ( "{}/2018-edition" , name) ;
243- builder. ensure ( RustbookSrc {
244- target,
245- name : INTERNER . intern_string ( source_name) ,
246- src : doc_src ( builder) ,
247- } ) ;
183+ for edition in & [ "first-edition" , "second-edition" , "2018-edition" ] {
184+ builder. ensure ( RustbookSrc {
185+ target,
186+ name : INTERNER . intern_string ( format ! ( "book/{}" , edition) ) ,
187+ src : INTERNER . intern_path ( builder. src . join ( "src/doc/book" ) . join ( edition) ) ,
188+ } ) ;
189+ }
248190
249191 // build the version info page and CSS
250192 builder. ensure ( Standalone { compiler, target } ) ;
@@ -531,7 +473,7 @@ impl Step for Rustc {
531473
532474 // Build cargo command.
533475 let mut cargo = builder. cargo ( compiler, Mode :: Rustc , target, "doc" ) ;
534- cargo. env ( "RUSTDOCFLAGS" , "--document-private-items --passes strip-hidden " ) ;
476+ cargo. env ( "RUSTDOCFLAGS" , "--document-private-items" ) ;
535477 compile:: rustc_cargo ( builder, & mut cargo, target) ;
536478
537479 // Only include compiler crates, no dependencies of those, such as `libc`.
0 commit comments