This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
src/librustdoc/html/render Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -297,7 +297,10 @@ pub(super) fn write_shared(
297297 . replace( "\\ \" " , "\\ \\ \" " )
298298 ) ) ;
299299 all_sources. sort ( ) ;
300- let mut v = String :: from ( "const srcIndex = new Map(JSON.parse('[\\ \n " ) ;
300+ // This needs to be `var`, not `const`.
301+ // This variable needs declared in the current global scope so that if
302+ // src-script.js loads first, it can pick it up.
303+ let mut v = String :: from ( "var srcIndex = new Map(JSON.parse('[\\ \n " ) ;
301304 v. push_str ( & all_sources. join ( ",\\ \n " ) ) ;
302305 v. push_str ( "\\ \n ]'));\n createSrcSidebar();\n " ) ;
303306 Ok ( v. into_bytes ( ) )
@@ -317,7 +320,10 @@ pub(super) fn write_shared(
317320 // with rustdoc running in parallel.
318321 all_indexes. sort ( ) ;
319322 write_invocation_specific ( "search-index.js" , & || {
320- let mut v = String :: from ( "const searchIndex = new Map(JSON.parse('[\\ \n " ) ;
323+ // This needs to be `var`, not `const`.
324+ // This variable needs declared in the current global scope so that if
325+ // search.js loads first, it can pick it up.
326+ let mut v = String :: from ( "var searchIndex = new Map(JSON.parse('[\\ \n " ) ;
321327 v. push_str ( & all_indexes. join ( ",\\ \n " ) ) ;
322328 v. push_str (
323329 r#"\
You can’t perform that action at this time.
0 commit comments