diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 637c6ef8e8e..309e5575ee4 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);
}