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.
This commit is contained in:
parent
cd8377d37e
commit
90adafbc9e
20 changed files with 139 additions and 79 deletions
|
|
@ -1,5 +0,0 @@
|
|||
// compile-flags: --document-private-items
|
||||
|
||||
// @has issue_46380/struct.Hidden.html
|
||||
#[doc(hidden)]
|
||||
pub struct Hidden;
|
||||
8
src/test/rustdoc/issue-67851-both.rs
Normal file
8
src/test/rustdoc/issue-67851-both.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// compile-flags: -Zunstable-options --document-private-items --document-hidden-items
|
||||
|
||||
// @has issue_67851_both/struct.Hidden.html
|
||||
#[doc(hidden)]
|
||||
pub struct Hidden;
|
||||
|
||||
// @has issue_67851_both/struct.Private.html
|
||||
struct Private;
|
||||
8
src/test/rustdoc/issue-67851-hidden.rs
Normal file
8
src/test/rustdoc/issue-67851-hidden.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// compile-flags: -Zunstable-options --document-hidden-items
|
||||
|
||||
// @has issue_67851_hidden/struct.Hidden.html
|
||||
#[doc(hidden)]
|
||||
pub struct Hidden;
|
||||
|
||||
// @!has issue_67851_hidden/struct.Private.html
|
||||
struct Private;
|
||||
6
src/test/rustdoc/issue-67851-neither.rs
Normal file
6
src/test/rustdoc/issue-67851-neither.rs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
// @!has issue_67851_neither/struct.Hidden.html
|
||||
#[doc(hidden)]
|
||||
pub struct Hidden;
|
||||
|
||||
// @!has issue_67851_neither/struct.Private.html
|
||||
struct Private;
|
||||
8
src/test/rustdoc/issue-67851-private.rs
Normal file
8
src/test/rustdoc/issue-67851-private.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// compile-flags: --document-private-items
|
||||
|
||||
// @!has issue_67851_private/struct.Hidden.html
|
||||
#[doc(hidden)]
|
||||
pub struct Hidden;
|
||||
|
||||
// @has issue_67851_private/struct.Private.html
|
||||
struct Private;
|
||||
Loading…
Add table
Add a link
Reference in a new issue