Skip to content

rustdoc: impls should link to their source #30416

Closed
@geofft

Description

@geofft

rustdoc pages for struct include a link to the source of the struct itself, at the top of the page. It would also be convenient if rustdoc had linked to the source (with line numbers) of each trait implementation it lists. There are two reasons for this:

  1. impls can come from a different source file than the struct itself; they can come from the file where the trait was defined. Common examples include Ext traits and the primitive types (which have no source of their own). But in these cases, the implementation shows up on the struct's documentation page.
  2. It's pretty common to use a macro to implement a trait, which means that it's hard to find visually where the impl is coming from. For instance, this line is the impl Iterator for core::slice::Iter.

And then you have cases where both of these are true....

Metadata

Metadata

Assignees

No one assigned

    Labels

    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