@@ -75,11 +75,11 @@ pub(crate) fn write_shared(
75
75
let crate_name = krate. name ( cx. tcx ( ) ) ;
76
76
let crate_name = crate_name. as_str ( ) ; // rand
77
77
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 ) ?;
79
79
let info = CrateInfo {
80
80
src_files_js : SourcesPart :: get ( cx, & crate_name_json) ?,
81
81
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 ) ?,
83
83
crates_index : CratesIndexPart :: get ( & crate_name, & external_crates) ?,
84
84
trait_impl : TraitAliasPart :: get ( cx, & crate_name_json) ?,
85
85
type_impl : TypeAliasPart :: get ( cx, krate, & crate_name_json) ?,
@@ -291,10 +291,13 @@ impl AllCratesPart {
291
291
SortedTemplate :: from_before_after ( "window.ALL_CRATES = [" , "];" )
292
292
}
293
293
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 > {
295
298
// external hack_get_external_crate_names not needed here, because
296
299
// 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 ) ;
298
301
Ok ( PartsAndLocations :: with ( path, crate_name_json) )
299
302
}
300
303
}
@@ -305,8 +308,11 @@ impl AllCratesPart {
305
308
///
306
309
/// This is to match the current behavior of rustdoc, which allows you to get all crates
307
310
/// 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) ) ;
310
316
let Ok ( content) = fs:: read_to_string ( & path) else {
311
317
// they didn't emit invocation specific, so we just say there were no crates
312
318
return Ok ( Vec :: default ( ) ) ;
0 commit comments