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

rustdoc: print associated types in traits "implementors" section #43515

Merged
merged 1 commit into from
Jul 30, 2017

Conversation

QuietMisdreavus
Copy link
Member

When viewing a trait's implementors, they won't show anything about the implementation other than any bounds on the generics. You can see the full implementation details on the page for the type, but if the type is external (e.g. it's an extension trait being implemented for primitives), then you'll never be able to see the details of the implementation without opening the source code. This doesn't solve everything about that, but it does still show an incredibly useful piece of information: the associated types. This can help immensely for traits like Deref or IntoIterator in libstd, and also for traits like IntoFuture outside the standard library.

Fixes #24200

🚨 BIKESHED ALERT 🚨 The indentation and sizing of the types is suspect. I put it in the small text so it wouldn't blend in with the next impl line. (It shares a CSS class with the where clauses, as you can see in the following image.) However, the indentation is nonstandard. I initially tried with no indentation (looked awkward and blended too well with the surrounding impls) and with 4-space indentation (too easy to confuse with where clauses), before settling on the 2-space indentation seen below. It's... okay, i guess. Open to suggestions.

snippet of the implementors of IntoIterator, showing the associated types

@rust-highfive
Copy link
Collaborator

r? @GuillaumeGomez

(rust_highfive has picked a reviewer for you, use r? to override)

@QuietMisdreavus QuietMisdreavus changed the title print associated types in traits "implementors" section rustdoc: print associated types in traits "implementors" section Jul 28, 2017
@QuietMisdreavus
Copy link
Member Author

I have a rendering of the libstd docs up for this change.

@shepmaster shepmaster added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 28, 2017
@GuillaumeGomez
Copy link
Member

As for now, it looks fine for me. Do you want to do something else in here or can I r+ it?

@QuietMisdreavus
Copy link
Member Author

If the formatting of the output looks fine to you, then I'm okay with an r+.

@GuillaumeGomez
Copy link
Member

Then let's go. Thanks!

@bors: r+

@bors
Copy link
Contributor

bors commented Jul 30, 2017

📌 Commit 612081a has been approved by GuillaumeGomez

@bors
Copy link
Contributor

bors commented Jul 30, 2017

⌛ Testing commit 612081a with merge 489b792...

bors added a commit that referenced this pull request Jul 30, 2017
…omez

rustdoc: print associated types in traits "implementors" section

When viewing a trait's implementors, they won't show anything about the implementation other than any bounds on the generics. You can see the full implementation details on the page for the type, but if the type is external (e.g. it's an extension trait being implemented for primitives), then you'll never be able to see the details of the implementation without opening the source code. This doesn't solve everything about that, but it does still show an incredibly useful piece of information: the associated types. This can help immensely for traits like `Deref` or `IntoIterator` in libstd, and also for traits like `IntoFuture` outside the standard library.

Fixes #24200

🚨 BIKESHED ALERT 🚨 The indentation and sizing of the types is suspect. I put it in the small text so it wouldn't blend in with the next impl line. (It shares a CSS class with the where clauses, as you can see in the following image.) However, the indentation is nonstandard. I initially tried with no indentation (looked awkward and blended too well with the surrounding impls) and with 4-space indentation (too easy to confuse with where clauses), before settling on the 2-space indentation seen below. It's... okay, i guess. Open to suggestions.

![snippet of the implementors of IntoIterator, showing the associated types](https://user-images.githubusercontent.com/5217170/28697456-a4e01a12-7301-11e7-868e-2a6441d6c9e0.png)
@bors
Copy link
Contributor

bors commented Jul 30, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: GuillaumeGomez
Pushing 489b792 to master...

@bors bors merged commit 612081a into rust-lang:master Jul 30, 2017
@QuietMisdreavus QuietMisdreavus deleted the show-assoc-types branch August 7, 2017 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants