Skip to content

Rustdoc should consider not hiding items that come from the same Cargo workspace #125009

@Urgau

Description

@Urgau
Member

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

Activity

added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
A-rustdoc-uiArea: Rustdoc UI (generated HTML)
C-discussionCategory: Discussion or questions that doesn't represent real issues.
T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
on May 11, 2024
removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on May 11, 2024
Nemo157

Nemo157 commented on May 13, 2024

@Nemo157
Member

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustdoc-uiArea: Rustdoc UI (generated HTML)C-discussionCategory: Discussion or questions that doesn't represent real issues.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Nemo157@Urgau@jieyouxu@rustbot

        Issue actions

          Rustdoc should consider not hiding items that come from the same Cargo workspace · Issue #125009 · rust-lang/rust