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 is confusing for use Foo as Bar types #111886

Open
nathan-at-least opened this issue May 23, 2023 · 0 comments
Open

rustdoc is confusing for use Foo as Bar types #111886

nathan-at-least opened this issue May 23, 2023 · 0 comments
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@nathan-at-least
Copy link

While examining API docs for ipfs_api_backend_hyper::IpfsClient I was confused about the relationship between the symbol IpfsClient and HyperBackend:

Screenshot 2023-05-23 11 09 19

I knew that rustdoc explicitly annotates type aliases, but that wasn't what I was seeing, so I fetched the code to examine and find a statement similar to use my_path::HyperBackend as IpfsClient. Ok, but could rustdoc have helped me know this was happening?

I expected to see this happen:

I hope to see some explicit indication that the two symbols refer to the same item. The actual approach might be tricky to get right in a manner that is explicit but not too much clutter.

I've seen rustdoc explicitly annotate that when re-exporting across crate boundaries. Is there some way to do this for intra-crate renaming re-exports so that the crate-level doc would move IpfsClient out of the structs section and into a re-exports section with a crate-local path? It currently looks like this:

image

With this proposed approach, the rendering for the type interface would consistently use HyperBackend.

Related Tickets

I searched this issue tracker with is:issue is:open use as label:A-rustdoc-ui to find these tickets both of which rename to _ which is distinct from my issue:

I filed this PR against rust-ipfs-api which replaces use foo as bar with explicit type aliases as a work-around. That PR has more screenshots of the difference in doc rendering between the two approaches.

Meta

rustc --version --verbose:

Whatever https://docs.rs used to render https://docs.rs/ipfs-api-backend-hyper/0.6.0/ipfs_api_backend_hyper/index.html

@nathan-at-least nathan-at-least added the C-bug Category: This is a bug. label May 23, 2023
@jyn514 jyn514 added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants