diff options
| author | Jacob Pratt <jacob@jhpratt.dev> | 2025-06-17 23:19:33 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-17 23:19:33 +0200 |
| commit | 0772ee7f8b2b4acac1f6e82b0f65a78b38817502 (patch) | |
| tree | 07e18ed42de3ccfc561e1b3402872b52acad4222 /src/librustdoc/html/render/write_shared.rs | |
| parent | 17ab49a94a9dd34c54852778310277a7a13cc006 (diff) | |
| parent | 00c104225fad5d3eb27dc37719d9b6c26844c389 (diff) | |
| download | rust-0772ee7f8b2b4acac1f6e82b0f65a78b38817502.tar.gz rust-0772ee7f8b2b4acac1f6e82b0f65a78b38817502.zip | |
Rollup merge of #142100 - lolbinarycat:rustdoc-srcIndex-138467, r=GuillaumeGomez
rustdoc: make srcIndex no longer a global variable this is one-time initialization data, it can just be a function parameter. while we're doing that, we can more the json parsing into the function and save a few extra bytes of storage for free, at least in the case of multiple crates in a doc bundle. fixes https://github.com/rust-lang/rust/issues/138467
Diffstat (limited to 'src/librustdoc/html/render/write_shared.rs')
| -rw-r--r-- | src/librustdoc/html/render/write_shared.rs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs index 33738f7a242..fb2b45802a6 100644 --- a/src/librustdoc/html/render/write_shared.rs +++ b/src/librustdoc/html/render/write_shared.rs @@ -477,11 +477,7 @@ impl SourcesPart { // This needs to be `var`, not `const`. // This variable needs declared in the current global scope so that if // src-script.js loads first, it can pick it up. - SortedTemplate::from_before_after( - r"var srcIndex = new Map(JSON.parse('[", - r"]')); -createSrcSidebar();", - ) + SortedTemplate::from_before_after(r"createSrcSidebar('[", r"]');") } fn get(cx: &Context<'_>, crate_name: &OrderedJson) -> Result<PartsAndLocations<Self>, Error> { |
