From aaf0ff83fb5473a1bd73f9062e168a7e183c444f Mon Sep 17 00:00:00 2001 From: Justus K Date: Fri, 14 May 2021 22:45:00 +0200 Subject: Call `initSidebarItems` in root module of crate --- src/librustdoc/html/render/mod.rs | 11 ++++++++--- src/librustdoc/html/render/write_shared.rs | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'src/librustdoc/html/render') diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 5b54b32e4dd..f4a84efb597 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -1745,12 +1745,17 @@ fn print_sidebar(cx: &Context<'_>, it: &clean::Item, buffer: &mut Buffer) { ty = it.type_(), path = relpath ); + if parentlen == 0 { - // There is no sidebar-items.js beyond the crate root path - // FIXME maybe dynamic crate loading can be merged here + write!( + buffer, + "", + relpath, cx.shared.resource_suffix + ); } else { - write!(buffer, "", path = relpath); + write!(buffer, "", relpath); } + // Closes sidebar-elems div. buffer.write_str(""); } diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs index d0518cb6862..ec54d94726e 100644 --- a/src/librustdoc/html/render/write_shared.rs +++ b/src/librustdoc/html/render/write_shared.rs @@ -225,6 +225,8 @@ pub(super) fn write_shared( )?; write_minify("search.js", static_files::SEARCH_JS)?; write_minify("settings.js", static_files::SETTINGS_JS)?; + write_minify("sidebar-items.js", static_files::sidebar::ITEMS)?; + if cx.shared.include_sources { write_minify("source-script.js", static_files::sidebar::SOURCE_SCRIPT)?; } -- cgit 1.4.1-3-g733a5