Skip to content

Commit

Permalink
Fix invalid path generation in rustdoc search
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed May 3, 2018
1 parent 96e1828 commit a876d28
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
6 changes: 4 additions & 2 deletions src/test/rustdoc-js/alias-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
],
};
4 changes: 2 additions & 2 deletions src/test/rustdoc-js/alias.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
],
};

0 comments on commit a876d28

Please sign in to comment.