diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2022-05-23 14:02:10 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-23 14:02:10 +0200 |
| commit | 8323b053b21cd8a61987d6e4b6c275338dc45cbb (patch) | |
| tree | c300715299e890db875cfd7692a771cb58611bb6 | |
| parent | d803caec7152818022223a7f538f531b015ca799 (diff) | |
| download | rust-8323b053b21cd8a61987d6e4b6c275338dc45cbb.tar.gz rust-8323b053b21cd8a61987d6e4b6c275338dc45cbb.zip | |
Greatly extend explanations on strip_hidden items
Co-authored-by: Michael Howell <michael@notriddle.com>
| -rw-r--r-- | src/librustdoc/passes/strip_hidden.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/librustdoc/passes/strip_hidden.rs b/src/librustdoc/passes/strip_hidden.rs index a8012185a6d..533e2ce46dd 100644 --- a/src/librustdoc/passes/strip_hidden.rs +++ b/src/librustdoc/passes/strip_hidden.rs @@ -38,7 +38,14 @@ impl<'a> DocFolder for Stripper<'a> { fn fold_item(&mut self, i: Item) -> Option<Item> { if i.attrs.lists(sym::doc).has_word(sym::hidden) { debug!("strip_hidden: stripping {:?} {:?}", i.type_(), i.name); - // use a dedicated hidden item for given item type if any + // Use a dedicated hidden item for fields, variants, and modules. + // We need to keep private fields and variants, so that the docs + // can show a placeholder "// some variants omitted". We need to keep + // private modules, because they can contain impl blocks, and impl + // block privacy is inherited from the type and trait, not from the + // module it's defined in. Both of these are marked "stripped," and + // not included in the final docs, but since they still have an effect + // on the final doc, cannot be completely removed from the Clean IR. match *i.kind { clean::StructFieldItem(..) | clean::ModuleItem(..) | clean::VariantItem(..) => { // We need to recurse into stripped modules to |
