diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 3ee131d8f5c8..d91b78c8416b 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -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 = "./";
diff --git a/src/test/rustdoc/static-root-path.rs b/src/test/rustdoc/static-root-path.rs
index 84b32f90c89a..2f7c89c5f1e6 100644
--- a/src/test/rustdoc/static-root-path.rs
+++ b/src/test/rustdoc/static-root-path.rs
@@ -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'