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 should consider not hiding items that come from the same Cargo workspace #125009

Open
Urgau opened this issue May 11, 2024 · 1 comment
Open
Labels
A-rustdoc-ui Area: rustdoc UI (generated HTML) C-discussion Category: Discussion or questions that doesn't represent real issues. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@Urgau
Copy link
Contributor

Urgau commented May 11, 2024

With PR #124939, rustdoc hides in the "Aliased type" section of type alias every type that is not from the current crate.

However if we had access in rustdoc to the Cargo workspace information we could instead be more fine-grain and not hide those coming from the same workspace.

Crate A:

pub struct One<T>(T);

Crate B:

pub type OneString = One<String>;

If crate A and B are in the same workspace we should probably not hide the inner item, and therefor display:

// in Aliased Type
struct OneString(String)

// instead of
struct OneString(/* private items */)

@rustbot labels +T-rustdoc +A-rustdoc-ui +C-discussion

@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. A-rustdoc-ui Area: rustdoc UI (generated HTML) C-discussion Category: Discussion or questions that doesn't represent real issues. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels May 11, 2024
@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 11, 2024
@Nemo157
Copy link
Member

Nemo157 commented May 13, 2024

Rather than rustdoc gaining workspace knowledge, another approach would be for cargo to pass a flag when building the in-workspace rmetas saying that they should have private details exposed. Then rustdoc could see this from the metadata when it's generating docs involving an external type. That leaves the policy of when to expose private details up to the build system, and you could imagine something like a --document-all-private-items flag for cargo that applies it to all dependencies, or applying it to non-workspace path dependencies as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-ui Area: rustdoc UI (generated HTML) C-discussion Category: Discussion or questions that doesn't represent real issues. 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

4 participants