diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 82d2c11b2497b..1f5a9447f46b3 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -344,7 +344,7 @@ if (!DOMTokenList.prototype.remove) {
var set_fragment = function(name) {
if (browserSupportsHistoryApi()) {
history.replaceState(null, null, "#" + name);
- window.hashchange();
+ highlightSourceLines(null);
} else {
location.replace("#" + name);
}