-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
regression: Rustdoc shows pub(self) as pub(in a::b) #79139
Copy link
Copy link
Closed
Labels
A-visibilityArea: Visibility / privacyArea: Visibility / privacyC-bugCategory: This is a bug.Category: This is a bug.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.Call 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.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.P-mediumMedium priorityMedium priorityT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant 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.Performance or correctness regression from stable to beta.
Metadata
Metadata
Assignees
Labels
A-visibilityArea: Visibility / privacyArea: Visibility / privacyC-bugCategory: This is a bug.Category: This is a bug.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.Call 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.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.P-mediumMedium priorityMedium priorityT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant 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.Performance or correctness regression from stable to beta.
Type
Fields
Give feedbackNo fields configured for issues without a type.
This is a pre-emptive bug report for when #77820 lands.
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::renderdoes not have access to aTyCtxtandimpl Clean for ty::Visibilitydoes not have access to the originalDefIdof the item being documented.impl Cleanneed 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.