diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 4e9781cc560..29e7bd37fc2 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -1427,7 +1427,7 @@ impl<'a> Cache {
}
if let Some(ref item_name) = item.name {
let path = self.paths.get(&item.def_id)
- .map(|p| p.0.join("::").to_string())
+ .map(|p| p.0[..p.0.len() - 1].join("::"))
.unwrap_or("std".to_owned());
for alias in item.attrs.lists("doc")
.filter(|a| a.check_name("alias"))
diff --git a/src/test/rustdoc-js/alias-2.js b/src/test/rustdoc-js/alias-2.js
index f31786df67c..0c5ec4fccbc 100644
--- a/src/test/rustdoc-js/alias-2.js
+++ b/src/test/rustdoc-js/alias-2.js
@@ -8,11 +8,13 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-order
+
const QUERY = '+';
const EXPECTED = {
'others': [
- { 'path': 'std::ops::AddAssign', 'name': 'AddAssign' },
- { 'path': 'std::ops::Add', 'name': 'Add' },
+ { 'path': 'std::ops', 'name': 'AddAssign' },
+ { 'path': 'std::ops', 'name': 'Add' },
],
};
diff --git a/src/test/rustdoc-js/alias.js b/src/test/rustdoc-js/alias.js
index a0500f24c17..0ca5991c06c 100644
--- a/src/test/rustdoc-js/alias.js
+++ b/src/test/rustdoc-js/alias.js
@@ -13,7 +13,7 @@ const QUERY = '[';
const EXPECTED = {
'others': [
{ 'path': 'std', 'name': 'slice' },
- { 'path': 'std::ops::IndexMut', 'name': 'IndexMut' },
- { 'path': 'std::ops::Index', 'name': 'Index' },
+ { 'path': 'std::ops', 'name': 'IndexMut' },
+ { 'path': 'std::ops', 'name': 'Index' },
],
};