Skip to content

Commit

Permalink
rustdoc: Don't add a resource-suffix to files that can't be shared ac…
Browse files Browse the repository at this point in the history
…ross crates

 rust-lang/docs.rs#1312
  • Loading branch information
jyn514 committed Mar 21, 2021
1 parent bbf07c0 commit 616dc5d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/librustdoc/html/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ crate fn render<T: Print, S: Print>(
{style_files}\
<script id=\"default-settings\"{default_settings}></script>\
<script src=\"{static_root_path}storage{suffix}.js\"></script>\
<script src=\"{root_path}crates{suffix}.js\"></script>\
<script src=\"{root_path}crates.js\"></script>\
<noscript><link rel=\"stylesheet\" href=\"{static_root_path}noscript{suffix}.css\"></noscript>\
{css_extension}\
{favicon}\
Expand Down Expand Up @@ -114,7 +114,7 @@ crate fn render<T: Print, S: Print>(
<section class=\"footer\"></section>\
{after_content}\
<div id=\"rustdoc-vars\" data-root-path=\"{root_path}\" data-current-crate=\"{krate}\" \
data-search-js=\"{root_path}search-index{suffix}.js\"></div>
data-search-js=\"{root_path}search-index.js\"></div>
<script src=\"{static_root_path}main{suffix}.js\"></script>\
{extra_scripts}\
</body>\
Expand Down
6 changes: 3 additions & 3 deletions src/librustdoc/html/render/write_shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ themePicker.onblur = handleThemeButtonsBlur;
}
}

let dst = cx.dst.join(&format!("source-files{}.js", cx.shared.resource_suffix));
let dst = cx.dst.join("source-files.js");
let (mut all_sources, _krates) =
try_err!(collect(&dst, &krate.name.as_str(), "sourcesIndex"), &dst);
all_sources.push(format!(
Expand All @@ -378,7 +378,7 @@ themePicker.onblur = handleThemeButtonsBlur;
}

// Update the search index and crate list.
let dst = cx.dst.join(&format!("search-index{}.js", cx.shared.resource_suffix));
let dst = cx.dst.join("search-index.js");
let (mut all_indexes, mut krates) = try_err!(collect_json(&dst, &krate.name.as_str()), &dst);
all_indexes.push(search_index);
krates.push(krate.name.to_string());
Expand All @@ -394,7 +394,7 @@ themePicker.onblur = handleThemeButtonsBlur;
cx.shared.fs.write(&dst, &v)?;
}

let crate_list_dst = cx.dst.join(&format!("crates{}.js", cx.shared.resource_suffix));
let crate_list_dst = cx.dst.join("crates.js");
let crate_list =
format!("window.ALL_CRATES = [{}];", krates.iter().map(|k| format!("\"{}\"", k)).join(","));
cx.shared.fs.write(&crate_list_dst, &crate_list)?;
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2970,7 +2970,7 @@ function defocusSearchBar() {
}
}

// `crates{version}.js` should always be loaded before this script, so we can use it safely.
// `crates.js` should always be loaded before this script, so we can use it safely.
addSearchOptions(window.ALL_CRATES);
addSidebarCrates(window.ALL_CRATES);

Expand Down

0 comments on commit 616dc5d

Please sign in to comment.