-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
doc(hidden) stopped working in binary crates #67851
Comments
Your suggestion seems entirely reasonable to me. I don't know what PR wuld need to go where to impl it. |
@rust-lang/cargo @rust-lang/rustdoc, any tips for what PRs would need to go where? |
Just for reference, the PR you linked (rust-lang/cargo#7593) is not directly responsible for the buggy behavior. You can see the problem with 1.40 by Could it be that we simply have to add a rust/src/librustdoc/passes/mod.rs Lines 89 to 98 in e845e69
|
Distinguish between private items and hidden items in rustdoc I believe rustdoc should not be conflating private items (visibility lower than `pub`) and hidden items (attribute `doc(hidden)`). This matters now that Cargo is passing --document-private-items by default for bin crates. In bin crates that rely on macros, intentionally hidden implementation details of the macros can overwhelm the actual useful internal API that one would want to document. This PR restores the strip-hidden pass when documenting private items, and introduces a separate unstable --document-hidden-items option to skip the strip-hidden pass. The two options are orthogonal to one another. Fixes rust-lang#67851. Closes rust-lang#60884.
Distinguish between private items and hidden items in rustdoc I believe rustdoc should not be conflating private items (visibility lower than `pub`) and hidden items (attribute `doc(hidden)`). This matters now that Cargo is passing --document-private-items by default for bin crates. In bin crates that rely on macros, intentionally hidden implementation details of the macros can overwhelm the actual useful internal API that one would want to document. This PR restores the strip-hidden pass when documenting private items, and introduces a separate unstable --document-hidden-items option to skip the strip-hidden pass. The two options are orthogonal to one another. Fixes rust-lang#67851. Closes rust-lang#60884.
rust-lang/cargo#7593 seems relevant. cc @LukasKalbertodt @Eh2406
If I have the following binary crate,
cargo doc
on stable 1.40.0 will correctly showg
and notf
, while beta will show both despitef
being doc(hidden).I understand that we want private things documented for bin crates, but I am labeling this a regression because this makes it impossible for macro-generated code to hide distracting implementation details that might overwhelm the actual useful API of the generated code.
I would like to suggest continuing to leave doc(hidden) items out of bin crate documentation as the default behavior of
cargo doc
.The text was updated successfully, but these errors were encountered: