@@ -75,11 +75,11 @@ pub(crate) fn write_shared(
7575 let crate_name = krate. name ( cx. tcx ( ) ) ;
7676 let crate_name = crate_name. as_str ( ) ; // rand
7777 let crate_name_json = OrderedJson :: serialize ( crate_name) . unwrap ( ) ; // "rand"
78- let external_crates = hack_get_external_crate_names ( & cx. dst ) ?;
78+ let external_crates = hack_get_external_crate_names ( & cx. dst , & cx . shared . resource_suffix ) ?;
7979 let info = CrateInfo {
8080 src_files_js : SourcesPart :: get ( cx, & crate_name_json) ?,
8181 search_index_js : SearchIndexPart :: get ( index, & cx. shared . resource_suffix ) ?,
82- all_crates : AllCratesPart :: get ( crate_name_json. clone ( ) ) ?,
82+ all_crates : AllCratesPart :: get ( crate_name_json. clone ( ) , & cx . shared . resource_suffix ) ?,
8383 crates_index : CratesIndexPart :: get ( & crate_name, & external_crates) ?,
8484 trait_impl : TraitAliasPart :: get ( cx, & crate_name_json) ?,
8585 type_impl : TypeAliasPart :: get ( cx, krate, & crate_name_json) ?,
@@ -291,10 +291,13 @@ impl AllCratesPart {
291291 SortedTemplate :: from_before_after ( "window.ALL_CRATES = [" , "];" )
292292 }
293293
294- fn get ( crate_name_json : OrderedJson ) -> Result < PartsAndLocations < Self > , Error > {
294+ fn get (
295+ crate_name_json : OrderedJson ,
296+ resource_suffix : & str ,
297+ ) -> Result < PartsAndLocations < Self > , Error > {
295298 // external hack_get_external_crate_names not needed here, because
296299 // there's no way that we write the search index but not crates.js
297- let path = PathBuf :: from ( "crates.js" ) ;
300+ let path = suffix_path ( "crates.js" , resource_suffix ) ;
298301 Ok ( PartsAndLocations :: with ( path, crate_name_json) )
299302 }
300303}
@@ -305,8 +308,11 @@ impl AllCratesPart {
305308///
306309/// This is to match the current behavior of rustdoc, which allows you to get all crates
307310/// on the index page, even if --enable-index-page is only passed to the last crate.
308- fn hack_get_external_crate_names ( doc_root : & Path ) -> Result < Vec < String > , Error > {
309- let path = doc_root. join ( "crates.js" ) ;
311+ fn hack_get_external_crate_names (
312+ doc_root : & Path ,
313+ resource_suffix : & str ,
314+ ) -> Result < Vec < String > , Error > {
315+ let path = doc_root. join ( suffix_path ( "crates.js" , resource_suffix) ) ;
310316 let Ok ( content) = fs:: read_to_string ( & path) else {
311317 // they didn't emit invocation specific, so we just say there were no crates
312318 return Ok ( Vec :: default ( ) ) ;
0 commit comments