Skip to content

Commit

Permalink
Rollup merge of rust-lang#59992 - QuietMisdreavus:static-settings-pat…
Browse files Browse the repository at this point in the history
…h, r=GuillaumeGomez

rustdoc: use --static-root-path for settings.js

At the time i was writing rust-lang/docs.rs#332, i noticed that the `settings.js` file that was being loaded was not being loaded from the `--static-root-path`. This PR fixes that so that users on docs.rs can effectively cache this file.
  • Loading branch information
Centril authored Apr 16, 2019
2 parents 9014cfc + 1c0e1c1 commit 426e747
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2113,7 +2113,8 @@ impl Context {
&final_file);

// Generating settings page.
let settings = Settings::new("./", &self.shared.resource_suffix);
let settings = Settings::new(self.shared.static_root_path.deref().unwrap_or("./"),
&self.shared.resource_suffix);
page.title = "Rustdoc settings";
page.description = "Settings of Rustdoc";
page.root_path = "./";
Expand Down
4 changes: 4 additions & 0 deletions src/test/rustdoc/static-root-path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ pub struct SomeStruct;
// @!matches - '"\.\./\.\./source-script\.js"'
// @matches - '"\.\./\.\./source-files.js"'
// @!matches - '"/cache/source-files\.js"'

// @has settings.html
// @matches - '/cache/settings\.js'
// @!matches - '\./settings\.js'

0 comments on commit 426e747

Please sign in to comment.