Skip to content

Commit

Permalink
Rollup merge of #107264 - ferrocene:pa-private-items, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Dylan-DPC authored Jan 30, 2023
2 parents e19ae97 + 8f84408 commit d94698c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ changelog-seen = 2
# and generated in already-minified form from the beginning.
#docs-minification = true

# Flag to specify whether private items should be included in the library docs.
#library-docs-private-items = false

# Indicate whether the compiler should be documented in addition to the standard
# library and facade crates.
#compiler-docs = false
Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ pub struct Config {
pub verbose: usize,
pub submodules: Option<bool>,
pub compiler_docs: bool,
pub library_docs_private_items: bool,
pub docs_minification: bool,
pub docs: bool,
pub locked_deps: bool,
Expand Down Expand Up @@ -606,6 +607,7 @@ define_config! {
rustfmt: Option<PathBuf> = "rustfmt",
docs: Option<bool> = "docs",
compiler_docs: Option<bool> = "compiler-docs",
library_docs_private_items: Option<bool> = "library-docs-private-items",
docs_minification: Option<bool> = "docs-minification",
submodules: Option<bool> = "submodules",
gdb: Option<String> = "gdb",
Expand Down Expand Up @@ -1018,6 +1020,7 @@ impl Config {
config.submodules = build.submodules;
set(&mut config.low_priority, build.low_priority);
set(&mut config.compiler_docs, build.compiler_docs);
set(&mut config.library_docs_private_items, build.library_docs_private_items);
set(&mut config.docs_minification, build.docs_minification);
set(&mut config.docs, build.docs);
set(&mut config.locked_deps, build.locked_deps);
Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,9 @@ fn doc_std(
.arg("--resource-suffix")
.arg(&builder.version)
.args(extra_args);
if builder.config.library_docs_private_items {
cargo.arg("--document-private-items").arg("--document-hidden-items");
}
builder.run(&mut cargo.into());
};

Expand Down

0 comments on commit d94698c

Please sign in to comment.