-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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: Private function is rendered with a verbose visibility #80101
Comments
searched nightlies: from nightly-2020-11-17 to nightly-2020-11-20 bisected with cargo-bisect-rustc v0.6.0Host triple: x86_64-apple-darwin cargo bisect-rustc --preserve --prompt --start=2020-11-17 --end=2020-11-20 -- doc --document-private-items I'm not sure if the commit it thinks has the regression is correct though.
and then after that it asked me again about c919f49, even though it asked me about it at the start of bisection. |
This is probably the same cause as #79139, although the fix may be slightly different.
The 'prompt' there makes me think you might have hit the wrong 'good/bad' option at some point. |
I did the bisection twice though and both times it had the same result. I wish |
@camelid you could write a script that does an xpath query on the generated documentation, maybe. |
At that point it's faster to do it manually. |
@camelid I wouldn't expect it to but I don't know without bisecting. |
I bisected a third time, and again I got the same result. I think it might be a bug in cargo-bisect-rustc. |
Well I can at least confirm that the bug is not present in beta, so this is a nightly regression. |
These are the PRs merged between the 17th and 18th (the 18th also has this bug): https://github.com/rust-lang/rust/pulls?q=is%3Amerged+is%3Apr+label%3AT-rustdoc+merged%3A2020-11-17..2020-11-18. |
Based on manually installing toolchains, I've confirmed that the issue was introduced in nightly-2020-11-19, so that's c919f49...8256379. |
I figured out that the reason it has weird formatting is that rustdoc will render functions like fn foo(
x: ...,
y: ...
) if the one-line version would be over 80 characters. This is the code that does that conditional formatting: rust/src/librustdoc/html/format.rs Line 1064 in 969b42d
So, the reason the weird formatting happens only on private functions is because the visibility is verbose and thus many functions end up being over 80 characters. We might consider increasing that limit to 100 characters since that's the Rust standard line length, but I'm not sure if that would degrade readability. |
Closing as duplicate of #79139. |
If I run
cargo +nightly doc --document-private-items
on this code:then the output looks like this:
Note that the visibility is verbose – it says
pub(in foo)
when it should show nothing (and used to show nothing).This bug only occurs when the function is private and
--document-private-items
is passed (of course, the docs are not generated without that flag).The text was updated successfully, but these errors were encountered: