Change:
Rustdoc defaults to only documented things that are public, i.e. things that the user of a library would care about. This is a good default, but rustdoc can also be useful to people working on large crates by documenting these crates themselves. In that case, it’s preferable to also include private types, fields, functions, and methods. was about this use case, and was closed with this solution: We just tried this on . It’s better than before, but has the unexpected side effect that every item (including non- and the implicit prelude) and every (including the implicit ) is documented under “Reexports”. It can get pretty noisy: ! They’re technically part of the crate, but don’t provide useful information. Could rustdoc split up the pass into one that strips private and , and one for everything else?

Discussion:
"concatenates all document attributes into one document attribute"), ("strip-private", passes::strip_private, "strips all private items from a crate which cannot be seen externally"), <ins> ("strip-priv-imports", passes::strip_priv_imports, "strips all private import statements (`use`, `extern crate`) from a crate"), </ins> ]; const DEFAULT_PASSES: &'static [&'static str] = &[

retained: &mut retained, access_levels: &access_levels, }; <del> krate = stripper.fold_crate(krate); </del> <ins> krate = ImportStripper.fold_crate(stripper.fold_crate(krate)); </ins> } // strip all private implementations of traits

} } <del> clean::ExternCrateItem(..) | clean::ImportItem(_) => { if i.visibility != Some(hir::Public) { return None } } </del> clean::StructFieldItem(..) => { if i.visibility != Some(hir::Public) { return Some(clean::Item {

return None; } } <ins> // handled in the `strip-priv-imports` pass clean::ExternCrateItem(..) | clean::ImportItem(_) => {} </ins> clean::DefaultImplItem(..) | clean::ImplItem(..) => {} // tymethods/macros have no control over privacy

} } <ins> // This stripper discards all private import statements (`use`, `extern crate`) struct ImportStripper; impl fold::DocFolder for ImportStripper { fn fold_item(&mut self, i: Item) -> Option<Item> { match i.inner { clean::ExternCrateItem(..) | clean::ImportItem(..) if i.visibility != Some(hir::Public) => None, _ => self.fold_item_recur(i) } } } pub fn strip_priv_imports(krate: clean::Crate)  -> plugins::PluginResult { (ImportStripper.fold_crate(krate), None) } </ins> pub fn unindent_comments(krate: clean::Crate) -> plugins::PluginResult { struct CommentCleaner;

<ins> // Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. </ins>

// option. This file may not be copied, modified, or distributed // except according to those terms. <del> // compile-flags:--no-defaults --passes "collapse-docs" --passes "unindent-comments" </del> <ins> // compile-flags:--no-defaults --passes collapse-docs --passes unindent-comments </ins> // @has issue_15347/fn.foo.html #[doc(hidden)]

<ins> // Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // compile-flags:--no-defaults --passes strip-priv-imports // aux-build:empty.rs // ignore-cross-compile // @has issue_27104/index.html // @!has - 'extern crate std' // @!has - 'use std::prelude::' // @has - 'pub extern crate empty' pub extern crate empty; </ins>