@@ -151,17 +151,25 @@ pub fn std(build: &Build, stage: u32, target: &str) {
151151 let mut cargo = build. cargo ( & compiler, Mode :: Libstd , target, "doc" ) ;
152152 cargo. arg ( "--manifest-path" )
153153 . arg ( build. src . join ( "src/rustc/std_shim/Cargo.toml" ) )
154- . arg ( "--features" ) . arg ( build. std_features ( ) )
155- . arg ( "--no-deps" ) ;
156-
157- for krate in & [ "alloc" , "collections" , "core" , "std" , "std_unicode" ] {
158- cargo. arg ( "-p" ) . arg ( krate) ;
159- // Create all crate output directories first to make sure rustdoc uses
160- // relative links.
161- // FIXME: Cargo should probably do this itself.
162- t ! ( fs:: create_dir_all( out_dir. join( krate) ) ) ;
154+ . arg ( "--features" ) . arg ( build. std_features ( ) ) ;
155+
156+ // We don't want to build docs for internal std dependencies unless
157+ // in compiler-docs mode. When not in that mode, we whitelist the crates
158+ // for which docs must be built.
159+ if build. config . compiler_docs {
160+ cargo. arg ( "-p" ) . arg ( "std" ) ;
161+ } else {
162+ cargo. arg ( "--no-deps" ) ;
163+ for krate in & [ "alloc" , "collections" , "core" , "std" , "std_unicode" ] {
164+ cargo. arg ( "-p" ) . arg ( krate) ;
165+ // Create all crate output directories first to make sure rustdoc uses
166+ // relative links.
167+ // FIXME: Cargo should probably do this itself.
168+ t ! ( fs:: create_dir_all( out_dir. join( krate) ) ) ;
169+ }
163170 }
164171
172+
165173 build. run ( & mut cargo) ;
166174 cp_r ( & out_dir, & out)
167175}
0 commit comments