Skip to content

Commit aad8787

Browse files
committed
Create a new flag, --document-private-items
Fixes #44136
1 parent 4adf6ae commit aad8787

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/librustdoc/lib.rs

+19
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ pub fn opts() -> Vec<RustcOptGroup> {
170170
stable("no-default", |o| {
171171
o.optflag("", "no-defaults", "don't run the default passes")
172172
}),
173+
stable("document-private-items", |o| {
174+
o.optflag("", "document-private-items", "document private items")
175+
}),
173176
stable("test", |o| o.optflag("", "test", "run code examples as tests")),
174177
stable("test-args", |o| {
175178
o.optmulti("", "test-args", "arguments to pass to the test runner",
@@ -461,6 +464,18 @@ where R: 'static + Send, F: 'static + Send + FnOnce(Output) -> R {
461464
let mut passes = matches.opt_strs("passes");
462465
let mut plugins = matches.opt_strs("plugins");
463466

467+
// We hardcode in the passes here, as this is a new flag and we
468+
// are generally deprecating passes.
469+
if matches.opt_present("document-private-items") {
470+
default_passes = false;
471+
472+
passes = vec![
473+
String::from("strip-hidden"),
474+
String::from("collapse-docs"),
475+
String::from("unindent-comments"),
476+
];
477+
}
478+
464479
// First, parse the crate and extract all relevant information.
465480
let mut paths = SearchPaths::new();
466481
for s in &matches.opt_strs("L") {
@@ -571,4 +586,8 @@ fn check_deprecated_options(matches: &getopts::Matches) {
571586
eprintln!("WARNING: please see https://github.com/rust-lang/rust/issues/44136");
572587
}
573588
}
589+
590+
if matches.opt_present("no-defaults") {
591+
eprintln!("WARNING: (you may want to use --document-private-items)");
592+
}
574593
}

0 commit comments

Comments
 (0)