diff --git a/extension/script/add-search-index.js b/extension/script/add-search-index.js index 2f432e99..10f6c087 100644 --- a/extension/script/add-search-index.js +++ b/extension/script/add-search-index.js @@ -69,15 +69,22 @@ } if (searchIndexJs) { - let script = document.createElement('script'); - script.src = searchIndexJs; - script.onload = sendSearchIndex; - document.head.append(script); + if (location.pathname.startsWith("/nightly/nightly-rustc/")) { + loadSearchIndex("/nightly/nightly-rustc/search-index.js"); + } else { + loadSearchIndex(searchIndexJs); + } } else { console.error("Sorry, no search index found."); } } + function loadSearchIndex(searchIndexJs) { + let script = document.createElement('script'); + script.src = searchIndexJs; + script.onload = sendSearchIndex; + document.head.append(script); + } // [rustdoc] Use Map instead of Object for source files and search index #118910 // https://github.com/rust-lang/rust/pull/118910