-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Restore trait impl docs #32935
Restore trait impl docs #32935
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @steveklabnik (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Love this change conceptually, not great with rustdoc's codebase yet. r? @alexcrichton |
I think it would make sense to instead only Then you could remove the |
Could you also add some tests in |
What the hell is happening in commits messages in here?! XD |
Actually, I think the current match on So the only necessary change would be to make here. |
I'm on board with everything @mitaa has mentioned :) |
Add test to check this resolves rust-lang#24838 and rust-lang#26871.
da0ef9d
to
d8d8669
Compare
Applied both of @mitaa's suggestions. Currently this means derived implementations also print any associated docs. Is that an issue? @GuillaumeGomez I don't know what you're talking about :D |
I would assume that they don't have any 😄
Yes, that's completely fine. |
In `test/rustdoc/manual_impl.rs` there are now three structs: * S1 implements and documents required method `a_method`. * S2 implements and documents `a_method` as well as provided method `b_method`. * S3 implements `a_method` and `b_method`, but only documents `b_method`. For a struct, we want the rendered trait impls to include documentation if and only if it appears on the trait implementation itself (since users can just go to the trait definition for anything not covered in the impl docs). This means we expect: * S1, S2, and S3 to all include top-level trait impl docs. * S1, S2, and S3 to exclude all trait definition docs. * S1 to show impl docs for `a_method`. * S2 to show impl docs for `a_method` and `b_method`. * S3 to show impl docs for `b_method`. These tests cover those cases.
@mitaa I'm looking at the docs (well, what I've updated the test to demonstrate the intended vs. actual behaviour, and now I'm hunting through |
Nice catch! For non-overridden default methods we actually render the method of the trait itself (which obviously has the doc attribute).
|
Well, that coupled with checking that |
We don't want to render default item docs but previously `doctraititem` naively delegated to the trait definition in those cases. Updated tests to also check that this doesn't strip default item docs from the trait definition.
Done. Also, it looks like the |
Thanks @pierzchalski! |
…s, r=alexcrichton Restore trait impl docs Currently, documentation on methods in trait implementations doesn't get rendered. This changes that; trait implementations have all documentation associated with impl items displayed (documentation from the trait definition is ignored). Fixes rust-lang#24838 Fixes rust-lang#26871
Currently, documentation on methods in trait implementations doesn't get rendered. This changes that; trait implementations have all documentation associated with impl items displayed (documentation from the trait definition is ignored).
Fixes #24838
Fixes #26871