Skip to content

Commit d94698c

Browse files
authored
Rollup merge of #107264 - ferrocene:pa-private-items, r=Mark-Simulacrum
Add option to include private items in library docs I need to perform some one-off analysis on libcore, and I wanted to use the unstable JSON rustdoc output to easily do it. Unfortunately, there is currently no way to include unstable items in the library docs. This PR adds support for that, with the off-by-default `build.library-docs-private-items` setting.
2 parents e19ae97 + 8f84408 commit d94698c

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

config.toml.example

+3
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@ changelog-seen = 2
233233
# and generated in already-minified form from the beginning.
234234
#docs-minification = true
235235

236+
# Flag to specify whether private items should be included in the library docs.
237+
#library-docs-private-items = false
238+
236239
# Indicate whether the compiler should be documented in addition to the standard
237240
# library and facade crates.
238241
#compiler-docs = false

src/bootstrap/config.rs

+3
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ pub struct Config {
6565
pub verbose: usize,
6666
pub submodules: Option<bool>,
6767
pub compiler_docs: bool,
68+
pub library_docs_private_items: bool,
6869
pub docs_minification: bool,
6970
pub docs: bool,
7071
pub locked_deps: bool,
@@ -606,6 +607,7 @@ define_config! {
606607
rustfmt: Option<PathBuf> = "rustfmt",
607608
docs: Option<bool> = "docs",
608609
compiler_docs: Option<bool> = "compiler-docs",
610+
library_docs_private_items: Option<bool> = "library-docs-private-items",
609611
docs_minification: Option<bool> = "docs-minification",
610612
submodules: Option<bool> = "submodules",
611613
gdb: Option<String> = "gdb",
@@ -1018,6 +1020,7 @@ impl Config {
10181020
config.submodules = build.submodules;
10191021
set(&mut config.low_priority, build.low_priority);
10201022
set(&mut config.compiler_docs, build.compiler_docs);
1023+
set(&mut config.library_docs_private_items, build.library_docs_private_items);
10211024
set(&mut config.docs_minification, build.docs_minification);
10221025
set(&mut config.docs, build.docs);
10231026
set(&mut config.locked_deps, build.locked_deps);

src/bootstrap/doc.rs

+3
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,9 @@ fn doc_std(
597597
.arg("--resource-suffix")
598598
.arg(&builder.version)
599599
.args(extra_args);
600+
if builder.config.library_docs_private_items {
601+
cargo.arg("--document-private-items").arg("--document-hidden-items");
602+
}
600603
builder.run(&mut cargo.into());
601604
};
602605

0 commit comments

Comments
 (0)