diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs
index 287c85b8c2253..7239b3c5ba2f6 100644
--- a/src/librustdoc/html/layout.rs
+++ b/src/librustdoc/html/layout.rs
@@ -158,7 +158,9 @@ pub fn render(
keywords = page.keywords,
favicon = if layout.favicon.is_empty() {
format!(
- r#""#,
+ r##"
+
+"##,
static_root_path = static_root_path,
suffix = page.resource_suffix
)
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index f095f67b54c63..8b5ba7a239c5f 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -754,7 +754,9 @@ fn write_shared(
write(cx.path("rust-logo.png"), static_files::RUST_LOGO)?;
}
if (*cx.shared).layout.favicon.is_empty() {
- write(cx.path("favicon.ico"), static_files::RUST_FAVICON)?;
+ write(cx.path("favicon.svg"), static_files::RUST_FAVICON_SVG)?;
+ write(cx.path("favicon-16x16.png"), static_files::RUST_FAVICON_PNG_16)?;
+ write(cx.path("favicon-32x32.png"), static_files::RUST_FAVICON_PNG_32)?;
}
write(cx.path("brush.svg"), static_files::BRUSH_SVG)?;
write(cx.path("wheel.svg"), static_files::WHEEL_SVG)?;
diff --git a/src/librustdoc/html/static/favicon-16x16.png b/src/librustdoc/html/static/favicon-16x16.png
new file mode 100644
index 0000000000000..7cfe6c13550d3
Binary files /dev/null and b/src/librustdoc/html/static/favicon-16x16.png differ
diff --git a/src/librustdoc/html/static/favicon-32x32.png b/src/librustdoc/html/static/favicon-32x32.png
new file mode 100644
index 0000000000000..5109c1de8bea7
Binary files /dev/null and b/src/librustdoc/html/static/favicon-32x32.png differ
diff --git a/src/librustdoc/html/static/favicon.ico b/src/librustdoc/html/static/favicon.ico
deleted file mode 100644
index b8ad23769ac8d..0000000000000
Binary files a/src/librustdoc/html/static/favicon.ico and /dev/null differ
diff --git a/src/librustdoc/html/static/favicon.svg b/src/librustdoc/html/static/favicon.svg
new file mode 100644
index 0000000000000..8b34b511989e1
--- /dev/null
+++ b/src/librustdoc/html/static/favicon.svg
@@ -0,0 +1,24 @@
+
diff --git a/src/librustdoc/html/static_files.rs b/src/librustdoc/html/static_files.rs
index 6bd7e53cdfbe2..213c7f3aab8b6 100644
--- a/src/librustdoc/html/static_files.rs
+++ b/src/librustdoc/html/static_files.rs
@@ -53,8 +53,10 @@ pub static LICENSE_MIT: &[u8] = include_bytes!("static/LICENSE-MIT.txt");
/// The contents of `rust-logo.png`, the default icon of the documentation.
pub static RUST_LOGO: &[u8] = include_bytes!("static/rust-logo.png");
-/// The contents of `favicon.ico`, the default favicon of the documentation.
-pub static RUST_FAVICON: &[u8] = include_bytes!("static/favicon.ico");
+/// The default documentation favicons (SVG and PNG fallbacks)
+pub static RUST_FAVICON_SVG: &[u8] = include_bytes!("static/favicon.svg");
+pub static RUST_FAVICON_PNG_16: &[u8] = include_bytes!("static/favicon-16x16.png");
+pub static RUST_FAVICON_PNG_32: &[u8] = include_bytes!("static/favicon-32x32.png");
/// The built-in themes given to every documentation site.
pub mod themes {