diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 0223475be4e..de7e4d2483b 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -587,9 +587,14 @@
} else if (item.parent !== undefined) {
var myparent = item.parent;
var anchor = '#' + type + '.' + name;
- displayPath = item.path + '::' + myparent.name + '::';
+ var parentType = itemTypes[myparent.ty];
+ if (parentType === "primitive") {
+ displayPath = myparent.name + '::';
+ } else {
+ displayPath = item.path + '::' + myparent.name + '::';
+ }
href = rootPath + item.path.replace(/::/g, '/') +
- '/' + itemTypes[myparent.ty] +
+ '/' + parentType +
'.' + myparent.name +
'.html' + anchor;
} else {