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

Track inlined items and merge their docstrings when creating clean attributes #92951

Closed

Conversation

lambinoo
Copy link
Contributor

Fixes #84619

@rust-highfive
Copy link
Collaborator

Some changes occurred in clean/types.rs.

cc @camelid

@rustbot rustbot added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jan 15, 2022
@rust-highfive
Copy link
Collaborator

r? @GuillaumeGomez

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 15, 2022
@camelid
Copy link
Member

camelid commented Jan 15, 2022

I think this will duplicate docstrings for non-local inlined items. I also think isn't the right approach. Can you try #84619 (comment)?

@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking rustdoc v0.0.0 (/checkout/src/librustdoc)
error[E0308]: mismatched types
   --> src/librustdoc/clean/types.rs:453:52
    |
453 |                 let other_attrs = cx.tcx.get_attrs(inlined_id).clean(cx);
    |                                                    ^^^^^^^^^^ expected struct `rustc_span::def_id::DefId`, found struct `LocalDefId`
For more information about this error, try `rustc --explain E0308`.
error: could not compile `rustdoc` due to previous error
Build completed unsuccessfully in 0:03:06

@lambinoo
Copy link
Contributor Author

lambinoo commented Jan 16, 2022

Update: I think I found a better way just by getting a better understanding of Rustdoc! I'll try to get some more work done during the following week.
@camelid I did add a tracing::warn at the beginning when I was trying to understand when it was being called. With the example in the issue, it never gets called.

I think that's the call path that's relevant:
try_inline < clean_use_statement < clean_maybe_renamed_item for each DocModule::items

DocModule::items itself gets filled by RustdocVisitor::visit_item(). When it comes to use statements, it only adds them to the stack when they are not being inlined themselves by maybe_inline_local.

That's the reason I took this path of keeping track of every "inlined" items.

@camelid camelid added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 3, 2022
@bors
Copy link
Contributor

bors commented Apr 19, 2022

☔ The latest upstream changes (presumably #96214) made this pull request unmergeable. Please resolve the merge conflicts.

@Dylan-DPC
Copy link
Member

@lambinoo any updates on this?

@Dylan-DPC
Copy link
Member

Closing this as inactive

@Dylan-DPC Dylan-DPC closed this Aug 1, 2022
@Dylan-DPC Dylan-DPC added S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Documentation on re-exports is ignored if the item is defined in the same crate
8 participants