Skip to content

Allow linking to specific impls in rustdoc #23552

Closed

Description

@huonw

It is useful if one is explaining where a method/functionality comes from to be able to link the specific impl ... for X on the page for X. E.g. I'm just now writing something about string slicing, so it would be nice to be able to point to the impl Index<Range<usize>> for str part of http://doc.rust-lang.org/nightly/std/primitive.str.html .

Activity

  1. added
    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
    on Mar 20, 2015
  2. changed the title [-]Allow linking to specific impls rustdoc[/-] [+]Allow linking to specific impls in rustdoc[/+] on Mar 20, 2015
  3. steveklabnik commented on Jun 6, 2016

    @steveklabnik
    Contributor

    Triage: no change here

  4. added
    T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.
    and removed on May 18, 2017
  5. mcarton commented on Jun 28, 2017

    @mcarton
    Contributor

    👍 This would be quite useful, I just wanted to point out to a friend why String + &str is possible, but there is no way to point to this particular implementation. This is especially annoying since this implementation is rather well documented.

  6. added
    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
    E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
    on Aug 15, 2017
  7. QuietMisdreavus commented on Aug 15, 2017

    @QuietMisdreavus
    Contributor

    This should be a fairly small change, so i'm opening it up to new contributors. in src/librustdoc/html/render.rs, there's a function called render_impl that has some code at the top that prints the impl line. The change to fix this would be to add a spot in between where it prints i.inner_impl() and the next print to add an anchor link that points to the h3 right there. There's a function available called derive_id that you can hand a potential id to that will make sure you get a unique anchor for your link. Actually inserting the anchor can be done like in #43747 so you get a nice section marker that pops up on hover.

    If you'd like to work on this and want help, let me know! I'm "misdreavus" on IRC. I'd love to get you acclimated to working on rustdoc.

  8. added a commit that references this issue on Aug 18, 2017
  9. added a commit that references this issue on Aug 26, 2017
  10. QuietMisdreavus commented on Aug 27, 2017

    @QuietMisdreavus
    Contributor

    Since #43979 got merged, i'll close out this issue.

  11. added a commit that references this issue on Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

C-feature-requestCategory: A feature request, i.e: not implemented / a PR.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions