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(
297
297
.replace("\\\"", "\\\\\"")
298
298
));
299
299
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");
301
304
v.push_str(&all_sources.join(",\\\n"));
302
305
v.push_str("\\\n]'));\ncreateSrcSidebar();\n");
303
306
Ok(v.into_bytes())
@@ -317,7 +320,10 @@ pub(super) fn write_shared(
317
320
// with rustdoc running in parallel.
318
321
all_indexes.sort();
319
322
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");
321
327
v.push_str(&all_indexes.join(",\\\n"));
322
328
v.push_str(
323
329
r#"\
You can’t perform that action at this time.
0 commit comments