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

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

Open
dtolnay opened this Issue May 31, 2017 · 1 comment

Comments

Projects
None yet
4 participants
@dtolnay
Copy link
Member

dtolnay commented May 31, 2017

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

@Stebalien

This comment has been minimized.

Copy link
Contributor

Stebalien commented Jun 11, 2017

I'd go one step further and hide or de-prioritize/collapse even more useless information in inlined trait documentation:

  • Methods with unsatisfiable where clauses (e.g. Self: NotImplementedTrait) to simplify the documentation (make it shorter and easier to tell what methods are available at a glance).
  • Always satisfied constraints in where clauses (e.g. where Self: Sized for sized types).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.