Skip to content

rustdoc primitve impl method anchors are not disambiguated #32890

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

Closed
brson opened this issue Apr 11, 2016 · 3 comments
Closed

rustdoc primitve impl method anchors are not disambiguated #32890

brson opened this issue Apr 11, 2016 · 3 comments
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@brson
Copy link
Contributor

brson commented Apr 11, 2016

The page for pointers contains impls for both *const and *mut but the links to their methods are not disambiguated by pointer type, so http://doc.rust-lang.org/nightly/std/primitive.pointer.html#method.as_ref is used for the anchor of both as_ref methods.

@brson brson added I-wrong T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Apr 11, 2016
@nagisa
Copy link
Member

nagisa commented Apr 11, 2016

cc #30036

@mitaa
Copy link
Contributor

mitaa commented Apr 12, 2016

This is because even though we're generating unique ids, the code that renders the methods and creates the links (render_assoc_item) does not know about the allocated id and creates a naive one itself..

render_assoc_item takes a

enum AssocItemLink<'a> {
    Anchor,
    GotoSource(DefId, &'a HashSet<String>),
}

where Anchor refers to an item on the current page and GotoSource refers to the trait pages item (used in the trait implementations section).

I think the best fix would be to change Anchor to Anchor(Option<String>) and fill it lazily with the allocated id from derive_id(..).

Relevant code is in src/librustdoc/html/render.rs.

Label as "E-easy"?

@alexcrichton alexcrichton added the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label Apr 12, 2016
@caipre
Copy link
Contributor

caipre commented Apr 14, 2016

I'll take a look at this.

bors added a commit that referenced this issue Apr 19, 2016
…excrichton

rustdoc: Disambiguate anchors

Closes #32890
critiqjo pushed a commit to critiqjo/rustdoc that referenced this issue Dec 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. 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

5 participants