diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index aa8fd7162ee..43c4f2b6ff5 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -354,13 +354,13 @@ function preLoadCss(cssUrl) { expandSection(pageId); } } - if (savedHash.startsWith("#impl-")) { + if (savedHash.startsWith("impl-")) { // impl-disambiguated links, used by the search engine // format: impl-X[-for-Y]/method.WHATEVER // turn this into method.WHATEVER[-NUMBER] const splitAt = savedHash.indexOf("/"); if (splitAt !== -1) { - const implId = savedHash.slice(1, splitAt); + const implId = savedHash.slice(0, splitAt); const assocId = savedHash.slice(splitAt + 1); const implElem = document.getElementById(implId); if (implElem && implElem.parentElement.tagName === "SUMMARY" && diff --git a/tests/rustdoc-gui/search-result-impl-disambiguation.goml b/tests/rustdoc-gui/search-result-impl-disambiguation.goml index 1596a3c4c6e..6d12032e891 100644 --- a/tests/rustdoc-gui/search-result-impl-disambiguation.goml +++ b/tests/rustdoc-gui/search-result-impl-disambiguation.goml @@ -2,7 +2,7 @@ // Checks that, if a type has two methods with the same name, they both get // linked correctly. -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // This should link to the inherent impl write: (".search-input", "ZyxwvutMethodDisambiguation -> bool") @@ -22,7 +22,7 @@ assert-document-property: ({ }, ENDS_WITH) assert: "section:target" -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // This should link to the trait impl write: (".search-input", "ZyxwvutMethodDisambiguation, usize -> usize")