Skip to content

regression: Rustdoc shows pub(self) as pub(in a::b) #79139

Closed
@jyn514

Description

@jyn514

This is a pre-emptive bug report for when #77820 lands.

mod a {
  mod b {
        pub(self) struct FooInSelfSuperB;
  }
}

I expected to see this happen: Rustdoc displays the privacy as written: pub(self) struct FooInSelfSuperB;

Instead, this happened: Rustdoc displays an absolute path: pub(in a::b) struct FooInSelfSuperB;

A similar bug exists for pub(super). The regressions for other paths (pub(super::super) -> pub(crate), pub(in crate::a::b) -> pub(in a::b), etc.) are explicitly not in scope and I don't plan to fix them.

Note that this always requires using --document-private-items.

Implementation Notes

This is not trivial to fix because html::render does not have access to a TyCtxt and impl Clean for ty::Visibility does not have access to the original DefId of the item being documented. impl Clean need to be turned into a free function, and #77820 (comment) needs to be debugged. See jyn514@b997e4f for partial progress on that; feel free to take over that branch if you're interested in fixing this.

Meta

This version of rustdoc has not yet landed; see #77820.

Metadata

Metadata

Assignees

Labels

A-visibilityArea: Visibility / privacyC-bugCategory: This is a bug.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.P-mediumMedium priorityT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions