Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustdoc: Inherent methods on trait objects are not indexed correctly #24137

Closed
alexcrichton opened this issue Apr 7, 2015 · 3 comments
Closed
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@alexcrichton
Copy link
Member

For example searching for downcast_ref generates incorrect links.

@alexcrichton alexcrichton added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Apr 7, 2015
alexcrichton referenced this issue in alexcrichton/rust Apr 8, 2015
This renders a "Methods" and "Trait Implementations" section for each item
implemented for a bare trait itself.

Closes rust-lang#19055
@bluss
Copy link
Member

bluss commented May 26, 2015

I think this fixes it: (It passes the tests we have and fixes that bug).

But I wanted to ask because maybe there's a reason we don't use this already.

diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 65652a4..ad372f1 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -921,8 +921,8 @@ impl DocFolder for Cache {
                         let last = self.parent_stack.last().unwrap();
                         let did = *last;
                         let path = match self.paths.get(&did) {
-                            Some(&(_, ItemType::Trait)) =>
-                                Some(&self.stack[..self.stack.len() - 1]),
+                            Some(&(ref fqp, ItemType::Trait)) =>
+                                Some(&fqp[..fqp.len() - 1]),
                             // The current stack not necessarily has correlation
                             // for where the type was defined. On the other
                             // hand, `paths` always has the right

@ollie27
Copy link
Member

ollie27 commented Aug 2, 2016

@alexcrichton
Copy link
Member Author

Yay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants