-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
regression: Rustdoc shows pub(self)
as pub(in a::b)
#79139
Comments
Assigning |
Is there any we can just access the original source code using a span? I guess the downside of that is there might be weird formatting, though we could just strip whitespace. Not sure if that's considered too hacky though. |
I would prefer not to do this by mangling the source code itself, rustdoc should not be parsing source code twice. The way to get the original behavior back is to get the visibility from the HIR instead of from metadata, but that means both a slowdown (because it will no longer be a query) and more code overall because all code will be penalized for the rare case of restricted visibility. |
Note from #80101: Another way this issue manifests is that private functions are shown as |
Since #80090 this can be done in render directly. |
@jyn514 I feel a bit confused: it seems that there are two |
Actually it seems like the part that needs to be changed is |
@camelid yes, I think the changing rust/src/librustdoc/html/format.rs Lines 1094 to 1096 in c34c015
The reason there's two different |
This regression is now on beta. Nominated the PR for beta backport. |
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::render
does not have access to aTyCtxt
andimpl Clean for ty::Visibility
does not have access to the originalDefId
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.
The text was updated successfully, but these errors were encountered: