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
@ -24,7 +24,7 @@ use crate::html;
|
|||||||
use crate::html::markdown::IdMap;
|
use crate::html::markdown::IdMap;
|
||||||
use crate::html::static_files;
|
use crate::html::static_files;
|
||||||
use crate::opts;
|
use crate::opts;
|
||||||
use crate::passes::{self, DefaultPassOption};
|
use crate::passes::{self, Condition, DefaultPassOption};
|
||||||
use crate::theme;
|
use crate::theme;
|
||||||
|
|
||||||
/// Configuration options for rustdoc.
|
/// Configuration options for rustdoc.
|
||||||
@ -98,6 +98,10 @@ pub struct Options {
|
|||||||
///
|
///
|
||||||
/// Be aware: This option can come both from the CLI and from crate attributes!
|
/// Be aware: This option can come both from the CLI and from crate attributes!
|
||||||
pub default_passes: DefaultPassOption,
|
pub default_passes: DefaultPassOption,
|
||||||
|
/// Document items that have lower than `pub` visibility.
|
||||||
|
pub document_private: bool,
|
||||||
|
/// Document items that have `doc(hidden)`.
|
||||||
|
pub document_hidden: bool,
|
||||||
/// Any passes manually selected by the user.
|
/// Any passes manually selected by the user.
|
||||||
///
|
///
|
||||||
/// Be aware: This option can come both from the CLI and from crate attributes!
|
/// Be aware: This option can come both from the CLI and from crate attributes!
|
||||||
@ -146,6 +150,8 @@ impl fmt::Debug for Options {
|
|||||||
.field("test_args", &self.test_args)
|
.field("test_args", &self.test_args)
|
||||||
.field("persist_doctests", &self.persist_doctests)
|
.field("persist_doctests", &self.persist_doctests)
|
||||||
.field("default_passes", &self.default_passes)
|
.field("default_passes", &self.default_passes)
|
||||||
|
.field("document_private", &self.document_private)
|
||||||
|
.field("document_hidden", &self.document_hidden)
|
||||||
.field("manual_passes", &self.manual_passes)
|
.field("manual_passes", &self.manual_passes)
|
||||||
.field("display_warnings", &self.display_warnings)
|
.field("display_warnings", &self.display_warnings)
|
||||||
.field("show_coverage", &self.show_coverage)
|
.field("show_coverage", &self.show_coverage)
|
||||||
@ -240,22 +246,26 @@ impl Options {
|
|||||||
println!("{:>20} - {}", pass.name, pass.description);
|
println!("{:>20} - {}", pass.name, pass.description);
|
||||||
}
|
}
|
||||||
println!("\nDefault passes for rustdoc:");
|
println!("\nDefault passes for rustdoc:");
|
||||||
for pass in passes::DEFAULT_PASSES {
|
for p in passes::DEFAULT_PASSES {
|
||||||
println!("{:>20}", pass.name);
|
print!("{:>20}", p.pass.name);
|
||||||
}
|
println_condition(p.condition);
|
||||||
println!("\nPasses run with `--document-private-items`:");
|
|
||||||
for pass in passes::DEFAULT_PRIVATE_PASSES {
|
|
||||||
println!("{:>20}", pass.name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if nightly_options::is_nightly_build() {
|
if nightly_options::is_nightly_build() {
|
||||||
println!("\nPasses run with `--show-coverage`:");
|
println!("\nPasses run with `--show-coverage`:");
|
||||||
for pass in passes::DEFAULT_COVERAGE_PASSES {
|
for p in passes::COVERAGE_PASSES {
|
||||||
println!("{:>20}", pass.name);
|
print!("{:>20}", p.pass.name);
|
||||||
|
println_condition(p.condition);
|
||||||
}
|
}
|
||||||
println!("\nPasses run with `--show-coverage --document-private-items`:");
|
}
|
||||||
for pass in passes::PRIVATE_COVERAGE_PASSES {
|
|
||||||
println!("{:>20}", pass.name);
|
fn println_condition(condition: Condition) {
|
||||||
|
use Condition::*;
|
||||||
|
match condition {
|
||||||
|
Always => println!(),
|
||||||
|
WhenDocumentPrivate => println!(" (when --document-private-items)"),
|
||||||
|
WhenNotDocumentPrivate => println!(" (when not --document-private-items)"),
|
||||||
|
WhenNotDocumentHidden => println!(" (when not --document-hidden-items)"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -449,16 +459,11 @@ impl Options {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let show_coverage = matches.opt_present("show-coverage");
|
let show_coverage = matches.opt_present("show-coverage");
|
||||||
let document_private = matches.opt_present("document-private-items");
|
|
||||||
|
|
||||||
let default_passes = if matches.opt_present("no-defaults") {
|
let default_passes = if matches.opt_present("no-defaults") {
|
||||||
passes::DefaultPassOption::None
|
passes::DefaultPassOption::None
|
||||||
} else if show_coverage && document_private {
|
|
||||||
passes::DefaultPassOption::PrivateCoverage
|
|
||||||
} else if show_coverage {
|
} else if show_coverage {
|
||||||
passes::DefaultPassOption::Coverage
|
passes::DefaultPassOption::Coverage
|
||||||
} else if document_private {
|
|
||||||
passes::DefaultPassOption::Private
|
|
||||||
} else {
|
} else {
|
||||||
passes::DefaultPassOption::Default
|
passes::DefaultPassOption::Default
|
||||||
};
|
};
|
||||||
@ -497,6 +502,8 @@ impl Options {
|
|||||||
let runtool = matches.opt_str("runtool");
|
let runtool = matches.opt_str("runtool");
|
||||||
let runtool_args = matches.opt_strs("runtool-arg");
|
let runtool_args = matches.opt_strs("runtool-arg");
|
||||||
let enable_per_target_ignores = matches.opt_present("enable-per-target-ignores");
|
let enable_per_target_ignores = matches.opt_present("enable-per-target-ignores");
|
||||||
|
let document_private = matches.opt_present("document-private-items");
|
||||||
|
let document_hidden = matches.opt_present("document-hidden-items");
|
||||||
|
|
||||||
let (lint_opts, describe_lints, lint_cap) = get_cmd_lint_options(matches, error_format);
|
let (lint_opts, describe_lints, lint_cap) = get_cmd_lint_options(matches, error_format);
|
||||||
|
|
||||||
@ -523,6 +530,8 @@ impl Options {
|
|||||||
should_test,
|
should_test,
|
||||||
test_args,
|
test_args,
|
||||||
default_passes,
|
default_passes,
|
||||||
|
document_private,
|
||||||
|
document_hidden,
|
||||||
manual_passes,
|
manual_passes,
|
||||||
display_warnings,
|
display_warnings,
|
||||||
show_coverage,
|
show_coverage,
|
||||||
|
@ -33,7 +33,7 @@ use crate::clean::{AttributesExt, MAX_DEF_ID};
|
|||||||
use crate::config::{Options as RustdocOptions, RenderOptions};
|
use crate::config::{Options as RustdocOptions, RenderOptions};
|
||||||
use crate::html::render::RenderInfo;
|
use crate::html::render::RenderInfo;
|
||||||
|
|
||||||
use crate::passes;
|
use crate::passes::{self, Condition::*, ConditionalPass};
|
||||||
|
|
||||||
pub use rustc::session::config::{CodegenOptions, Input, Options};
|
pub use rustc::session::config::{CodegenOptions, Input, Options};
|
||||||
pub use rustc::session::search_paths::SearchPath;
|
pub use rustc::session::search_paths::SearchPath;
|
||||||
@ -234,6 +234,8 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
|
|||||||
describe_lints,
|
describe_lints,
|
||||||
lint_cap,
|
lint_cap,
|
||||||
mut default_passes,
|
mut default_passes,
|
||||||
|
mut document_private,
|
||||||
|
document_hidden,
|
||||||
mut manual_passes,
|
mut manual_passes,
|
||||||
display_warnings,
|
display_warnings,
|
||||||
render_options,
|
render_options,
|
||||||
@ -470,16 +472,14 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
|
|||||||
}
|
}
|
||||||
|
|
||||||
if attr.is_word() && name == sym::document_private_items {
|
if attr.is_word() && name == sym::document_private_items {
|
||||||
if default_passes == passes::DefaultPassOption::Default {
|
document_private = true;
|
||||||
default_passes = passes::DefaultPassOption::Private;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let passes = passes::defaults(default_passes).iter().chain(
|
let passes = passes::defaults(default_passes).iter().copied().chain(
|
||||||
manual_passes.into_iter().flat_map(|name| {
|
manual_passes.into_iter().flat_map(|name| {
|
||||||
if let Some(pass) = passes::find_pass(&name) {
|
if let Some(pass) = passes::find_pass(&name) {
|
||||||
Some(pass)
|
Some(ConditionalPass::always(pass))
|
||||||
} else {
|
} else {
|
||||||
error!("unknown pass {}, skipping", name);
|
error!("unknown pass {}, skipping", name);
|
||||||
None
|
None
|
||||||
@ -489,9 +489,17 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
|
|||||||
|
|
||||||
info!("Executing passes");
|
info!("Executing passes");
|
||||||
|
|
||||||
for pass in passes {
|
for p in passes {
|
||||||
debug!("running pass {}", pass.name);
|
let run = match p.condition {
|
||||||
krate = (pass.pass)(krate, &ctxt);
|
Always => true,
|
||||||
|
WhenDocumentPrivate => document_private,
|
||||||
|
WhenNotDocumentPrivate => !document_private,
|
||||||
|
WhenNotDocumentHidden => !document_hidden,
|
||||||
|
};
|
||||||
|
if run {
|
||||||
|
debug!("running pass {}", p.pass.name);
|
||||||
|
krate = (p.pass.run)(krate, &ctxt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ctxt.sess().abort_if_errors();
|
ctxt.sess().abort_if_errors();
|
||||||
|
@ -173,6 +173,9 @@ fn opts() -> Vec<RustcOptGroup> {
|
|||||||
stable("document-private-items", |o| {
|
stable("document-private-items", |o| {
|
||||||
o.optflag("", "document-private-items", "document private items")
|
o.optflag("", "document-private-items", "document private items")
|
||||||
}),
|
}),
|
||||||
|
unstable("document-hidden-items", |o| {
|
||||||
|
o.optflag("", "document-hidden-items", "document items that have doc(hidden)")
|
||||||
|
}),
|
||||||
stable("test", |o| o.optflag("", "test", "run code examples as tests")),
|
stable("test", |o| o.optflag("", "test", "run code examples as tests")),
|
||||||
stable("test-args", |o| {
|
stable("test-args", |o| {
|
||||||
o.optmulti("", "test-args", "arguments to pass to the test runner", "ARGS")
|
o.optmulti("", "test-args", "arguments to pass to the test runner", "ARGS")
|
||||||
|
@ -12,7 +12,7 @@ use std::ops;
|
|||||||
|
|
||||||
pub const CALCULATE_DOC_COVERAGE: Pass = Pass {
|
pub const CALCULATE_DOC_COVERAGE: Pass = Pass {
|
||||||
name: "calculate-doc-coverage",
|
name: "calculate-doc-coverage",
|
||||||
pass: calculate_doc_coverage,
|
run: calculate_doc_coverage,
|
||||||
description: "counts the number of items with and without documentation",
|
description: "counts the number of items with and without documentation",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ use crate::passes::Pass;
|
|||||||
|
|
||||||
pub const CHECK_CODE_BLOCK_SYNTAX: Pass = Pass {
|
pub const CHECK_CODE_BLOCK_SYNTAX: Pass = Pass {
|
||||||
name: "check-code-block-syntax",
|
name: "check-code-block-syntax",
|
||||||
pass: check_code_block_syntax,
|
run: check_code_block_syntax,
|
||||||
description: "validates syntax inside Rust code blocks",
|
description: "validates syntax inside Rust code blocks",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ use std::mem::take;
|
|||||||
|
|
||||||
pub const COLLAPSE_DOCS: Pass = Pass {
|
pub const COLLAPSE_DOCS: Pass = Pass {
|
||||||
name: "collapse-docs",
|
name: "collapse-docs",
|
||||||
pass: collapse_docs,
|
run: collapse_docs,
|
||||||
description: "concatenates all document attributes into one document attribute",
|
description: "concatenates all document attributes into one document attribute",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ use super::span_of_attrs;
|
|||||||
|
|
||||||
pub const COLLECT_INTRA_DOC_LINKS: Pass = Pass {
|
pub const COLLECT_INTRA_DOC_LINKS: Pass = Pass {
|
||||||
name: "collect-intra-doc-links",
|
name: "collect-intra-doc-links",
|
||||||
pass: collect_intra_doc_links,
|
run: collect_intra_doc_links,
|
||||||
description: "reads a crate's documentation to resolve intra-doc-links",
|
description: "reads a crate's documentation to resolve intra-doc-links",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ use rustc_span::symbol::sym;
|
|||||||
|
|
||||||
pub const COLLECT_TRAIT_IMPLS: Pass = Pass {
|
pub const COLLECT_TRAIT_IMPLS: Pass = Pass {
|
||||||
name: "collect-trait-impls",
|
name: "collect-trait-impls",
|
||||||
pass: collect_trait_impls,
|
run: collect_trait_impls,
|
||||||
description: "retrieves trait impls for items in the crate",
|
description: "retrieves trait impls for items in the crate",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ use rustc_span::{InnerSpan, Span, DUMMY_SP};
|
|||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ops::Range;
|
use std::ops::Range;
|
||||||
|
|
||||||
|
use self::Condition::*;
|
||||||
use crate::clean::{self, GetDefId, Item};
|
use crate::clean::{self, GetDefId, Item};
|
||||||
use crate::core::DocContext;
|
use crate::core::DocContext;
|
||||||
use crate::fold::{DocFolder, StripItem};
|
use crate::fold::{DocFolder, StripItem};
|
||||||
@ -53,10 +54,29 @@ pub use self::calculate_doc_coverage::CALCULATE_DOC_COVERAGE;
|
|||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub struct Pass {
|
pub struct Pass {
|
||||||
pub name: &'static str,
|
pub name: &'static str,
|
||||||
pub pass: fn(clean::Crate, &DocContext<'_>) -> clean::Crate,
|
pub run: fn(clean::Crate, &DocContext<'_>) -> clean::Crate,
|
||||||
pub description: &'static str,
|
pub description: &'static str,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// In a list of passes, a pass that may or may not need to be run depending on options.
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
pub struct ConditionalPass {
|
||||||
|
pub pass: Pass,
|
||||||
|
pub condition: Condition,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// How to decide whether to run a conditional pass.
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
pub enum Condition {
|
||||||
|
Always,
|
||||||
|
/// When `--document-private-items` is passed.
|
||||||
|
WhenDocumentPrivate,
|
||||||
|
/// When `--document-private-items` is not passed.
|
||||||
|
WhenNotDocumentPrivate,
|
||||||
|
/// When `--document-hidden-items` is not passed.
|
||||||
|
WhenNotDocumentHidden,
|
||||||
|
}
|
||||||
|
|
||||||
/// The full list of passes.
|
/// The full list of passes.
|
||||||
pub const PASSES: &[Pass] = &[
|
pub const PASSES: &[Pass] = &[
|
||||||
CHECK_PRIVATE_ITEMS_DOC_TESTS,
|
CHECK_PRIVATE_ITEMS_DOC_TESTS,
|
||||||
@ -73,63 +93,58 @@ pub const PASSES: &[Pass] = &[
|
|||||||
];
|
];
|
||||||
|
|
||||||
/// The list of passes run by default.
|
/// The list of passes run by default.
|
||||||
pub const DEFAULT_PASSES: &[Pass] = &[
|
pub const DEFAULT_PASSES: &[ConditionalPass] = &[
|
||||||
COLLECT_TRAIT_IMPLS,
|
ConditionalPass::always(COLLECT_TRAIT_IMPLS),
|
||||||
COLLAPSE_DOCS,
|
ConditionalPass::always(COLLAPSE_DOCS),
|
||||||
UNINDENT_COMMENTS,
|
ConditionalPass::always(UNINDENT_COMMENTS),
|
||||||
CHECK_PRIVATE_ITEMS_DOC_TESTS,
|
ConditionalPass::always(CHECK_PRIVATE_ITEMS_DOC_TESTS),
|
||||||
STRIP_HIDDEN,
|
ConditionalPass::new(STRIP_HIDDEN, WhenNotDocumentHidden),
|
||||||
STRIP_PRIVATE,
|
ConditionalPass::new(STRIP_PRIVATE, WhenNotDocumentPrivate),
|
||||||
COLLECT_INTRA_DOC_LINKS,
|
ConditionalPass::new(STRIP_PRIV_IMPORTS, WhenDocumentPrivate),
|
||||||
CHECK_CODE_BLOCK_SYNTAX,
|
ConditionalPass::always(COLLECT_INTRA_DOC_LINKS),
|
||||||
PROPAGATE_DOC_CFG,
|
ConditionalPass::always(CHECK_CODE_BLOCK_SYNTAX),
|
||||||
];
|
ConditionalPass::always(PROPAGATE_DOC_CFG),
|
||||||
|
|
||||||
/// The list of default passes run with `--document-private-items` is passed to rustdoc.
|
|
||||||
pub const DEFAULT_PRIVATE_PASSES: &[Pass] = &[
|
|
||||||
COLLECT_TRAIT_IMPLS,
|
|
||||||
COLLAPSE_DOCS,
|
|
||||||
UNINDENT_COMMENTS,
|
|
||||||
CHECK_PRIVATE_ITEMS_DOC_TESTS,
|
|
||||||
STRIP_PRIV_IMPORTS,
|
|
||||||
COLLECT_INTRA_DOC_LINKS,
|
|
||||||
CHECK_CODE_BLOCK_SYNTAX,
|
|
||||||
PROPAGATE_DOC_CFG,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/// The list of default passes run when `--doc-coverage` is passed to rustdoc.
|
/// The list of default passes run when `--doc-coverage` is passed to rustdoc.
|
||||||
pub const DEFAULT_COVERAGE_PASSES: &[Pass] =
|
pub const COVERAGE_PASSES: &[ConditionalPass] = &[
|
||||||
&[COLLECT_TRAIT_IMPLS, STRIP_HIDDEN, STRIP_PRIVATE, CALCULATE_DOC_COVERAGE];
|
ConditionalPass::always(COLLECT_TRAIT_IMPLS),
|
||||||
|
ConditionalPass::new(STRIP_HIDDEN, WhenNotDocumentHidden),
|
||||||
|
ConditionalPass::new(STRIP_PRIVATE, WhenNotDocumentPrivate),
|
||||||
|
ConditionalPass::always(CALCULATE_DOC_COVERAGE),
|
||||||
|
];
|
||||||
|
|
||||||
/// The list of default passes run when `--doc-coverage --document-private-items` is passed to
|
impl ConditionalPass {
|
||||||
/// rustdoc.
|
pub const fn always(pass: Pass) -> Self {
|
||||||
pub const PRIVATE_COVERAGE_PASSES: &[Pass] = &[COLLECT_TRAIT_IMPLS, CALCULATE_DOC_COVERAGE];
|
Self::new(pass, Always)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const fn new(pass: Pass, condition: Condition) -> Self {
|
||||||
|
ConditionalPass { pass, condition }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// A shorthand way to refer to which set of passes to use, based on the presence of
|
/// A shorthand way to refer to which set of passes to use, based on the presence of
|
||||||
/// `--no-defaults` or `--document-private-items`.
|
/// `--no-defaults` and `--show-coverage`.
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||||
pub enum DefaultPassOption {
|
pub enum DefaultPassOption {
|
||||||
Default,
|
Default,
|
||||||
Private,
|
|
||||||
Coverage,
|
Coverage,
|
||||||
PrivateCoverage,
|
|
||||||
None,
|
None,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the given default set of passes.
|
/// Returns the given default set of passes.
|
||||||
pub fn defaults(default_set: DefaultPassOption) -> &'static [Pass] {
|
pub fn defaults(default_set: DefaultPassOption) -> &'static [ConditionalPass] {
|
||||||
match default_set {
|
match default_set {
|
||||||
DefaultPassOption::Default => DEFAULT_PASSES,
|
DefaultPassOption::Default => DEFAULT_PASSES,
|
||||||
DefaultPassOption::Private => DEFAULT_PRIVATE_PASSES,
|
DefaultPassOption::Coverage => COVERAGE_PASSES,
|
||||||
DefaultPassOption::Coverage => DEFAULT_COVERAGE_PASSES,
|
|
||||||
DefaultPassOption::PrivateCoverage => PRIVATE_COVERAGE_PASSES,
|
|
||||||
DefaultPassOption::None => &[],
|
DefaultPassOption::None => &[],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If the given name matches a known pass, returns its information.
|
/// If the given name matches a known pass, returns its information.
|
||||||
pub fn find_pass(pass_name: &str) -> Option<&'static Pass> {
|
pub fn find_pass(pass_name: &str) -> Option<Pass> {
|
||||||
PASSES.iter().find(|p| p.name == pass_name)
|
PASSES.iter().find(|p| p.name == pass_name).copied()
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Stripper<'a> {
|
struct Stripper<'a> {
|
||||||
|
@ -5,7 +5,7 @@ use crate::passes::{look_for_tests, Pass};
|
|||||||
|
|
||||||
pub const CHECK_PRIVATE_ITEMS_DOC_TESTS: Pass = Pass {
|
pub const CHECK_PRIVATE_ITEMS_DOC_TESTS: Pass = Pass {
|
||||||
name: "check-private-items-doc-tests",
|
name: "check-private-items-doc-tests",
|
||||||
pass: check_private_items_doc_tests,
|
run: check_private_items_doc_tests,
|
||||||
description: "check private items doc tests",
|
description: "check private items doc tests",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ use crate::passes::Pass;
|
|||||||
|
|
||||||
pub const PROPAGATE_DOC_CFG: Pass = Pass {
|
pub const PROPAGATE_DOC_CFG: Pass = Pass {
|
||||||
name: "propagate-doc-cfg",
|
name: "propagate-doc-cfg",
|
||||||
pass: propagate_doc_cfg,
|
run: propagate_doc_cfg,
|
||||||
description: "propagates `#[doc(cfg(...))]` to child items",
|
description: "propagates `#[doc(cfg(...))]` to child items",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ use crate::passes::{ImplStripper, Pass};
|
|||||||
|
|
||||||
pub const STRIP_HIDDEN: Pass = Pass {
|
pub const STRIP_HIDDEN: Pass = Pass {
|
||||||
name: "strip-hidden",
|
name: "strip-hidden",
|
||||||
pass: strip_hidden,
|
run: strip_hidden,
|
||||||
description: "strips all doc(hidden) items from the output",
|
description: "strips all doc(hidden) items from the output",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ use crate::passes::{ImportStripper, Pass};
|
|||||||
|
|
||||||
pub const STRIP_PRIV_IMPORTS: Pass = Pass {
|
pub const STRIP_PRIV_IMPORTS: Pass = Pass {
|
||||||
name: "strip-priv-imports",
|
name: "strip-priv-imports",
|
||||||
pass: strip_priv_imports,
|
run: strip_priv_imports,
|
||||||
description: "strips all private import statements (`use`, `extern crate`) from a crate",
|
description: "strips all private import statements (`use`, `extern crate`) from a crate",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ use crate::passes::{ImplStripper, ImportStripper, Pass, Stripper};
|
|||||||
|
|
||||||
pub const STRIP_PRIVATE: Pass = Pass {
|
pub const STRIP_PRIVATE: Pass = Pass {
|
||||||
name: "strip-private",
|
name: "strip-private",
|
||||||
pass: strip_private,
|
run: strip_private,
|
||||||
description: "strips all private items from a crate which cannot be seen externally, \
|
description: "strips all private items from a crate which cannot be seen externally, \
|
||||||
implies strip-priv-imports",
|
implies strip-priv-imports",
|
||||||
};
|
};
|
||||||
|
@ -12,7 +12,7 @@ mod tests;
|
|||||||
|
|
||||||
pub const UNINDENT_COMMENTS: Pass = Pass {
|
pub const UNINDENT_COMMENTS: Pass = Pass {
|
||||||
name: "unindent-comments",
|
name: "unindent-comments",
|
||||||
pass: unindent_comments,
|
run: unindent_comments,
|
||||||
description: "removes excess indentation on comments in order for markdown to like it",
|
description: "removes excess indentation on comments in order for markdown to like it",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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…
x
Reference in New Issue
Block a user