rustdoc: Fix searching for default methods

Closes #9566
This commit is contained in:
Alex Crichton 2013-09-27 10:45:09 -07:00
parent c5e03bec4d
commit a925762c3b
1 changed files with 6 additions and 2 deletions

View File

@ -259,8 +259,12 @@ impl<'self> DocFolder for Cache {
if self.parent_stack.len() == 0 {
None
} else {
Some((Some(*self.parent_stack.last()),
self.stack.as_slice()))
let last = self.parent_stack.last();
let amt = match self.paths.find(last) {
Some(&(_, "trait")) => self.stack.len() - 1,
Some(*) | None => self.stack.len(),
};
Some((Some(*last), self.stack.slice_to(amt)))
}
}
_ => Some((None, self.stack.as_slice()))