Skip to content

In rustdoc, omit trait impls that a user cannot call #42323

@dtolnay

Description

@dtolnay
pub struct Public;
struct Private;

impl From<Private> for Public {
    fn from(_: Private) -> Self {
        unimplemented!()
    }
}

The rustdoc of Public displays a From impl that cannot be invoked by users of the crate.

selection_057

I'm sure there are lots of edge cases to consider, but this is a common pattern especially for error types for use with ?. It would be nice to hide such impls from rustdoc without requiring the crate author to tag them with #[doc(hidden)].

This came up during the libz blitz evaluation of the reqwest crate. seanmonstar/reqwest#106

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-visibilityArea: Visibility / privacyC-feature-requestCategory: A feature request, i.e: not implemented / a PR.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