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:
David Tolnay
2020-01-04 10:58:32 -08:00
parent cd8377d37e
commit 90adafbc9e
20 changed files with 139 additions and 79 deletions

View File

@@ -12,7 +12,7 @@ use std::ops;
pub const CALCULATE_DOC_COVERAGE: Pass = Pass {
name: "calculate-doc-coverage",
pass: calculate_doc_coverage,
run: calculate_doc_coverage,
description: "counts the number of items with and without documentation",
};