Skip to content

Commit 24be917

Browse files
committed
rustdoc: add mergeable CCI docs to the unstable feature book
1 parent 9ea8d67 commit 24be917

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/doc/rustdoc/src/unstable-features.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,37 @@ themselves marked as unstable. To use any of these options, pass `-Z unstable-op
197197
the flag in question to Rustdoc on the command-line. To do this from Cargo, you can either use the
198198
`RUSTDOCFLAGS` environment variable or the `cargo rustdoc` command.
199199

200+
### `--merge`, `--parts-out-dir`, and `--include-parts-dir`
201+
202+
These options control how rustdoc handles files that combine data from multiple crates.
203+
204+
By default, they act like `--merge=shared` is set, and `--parts-out-dir` and `--include-parts-dir`
205+
are turned off. The `--merge=shared` mode causes rustdoc to load the existing data in the out-dir,
206+
combine the new crate data into it, and write the result. This is very easy to use in scripts that
207+
manually invoke rustdoc, but it's also slow, because it performs O(crates) work on
208+
every crate, meaning it performs O(crates<sup>2</sup>) work.
209+
210+
```console
211+
$ rustdoc crate1.rs --out-dir=doc
212+
$ cat doc/search.index/crateNames/*
213+
rd_("fcrate1")
214+
$ rustdoc crate2.rs --out-dir=doc
215+
$ cat doc/search.index/crateNames/*
216+
rd_("fcrate1fcrate2")
217+
```
218+
219+
To delay shared-data merging until the end of a build, so that you only have to perform O(crates)
220+
work, use `--merge=none` on every crate except the last one, which will use `--merge=finalize`.
221+
222+
```console
223+
$ rustdoc +nightly crate1.rs --merge=none --parts-out-dir=crate1.d -Zunstable-options
224+
$ cat doc/search.index/crateNames/*
225+
cat: 'doc/search.index/crateNames/*': No such file or directory
226+
$ rustdoc +nightly crate2.rs --merge=finalize --include-parts-dir=crate1.d -Zunstable-options
227+
$ cat doc/search.index/crateNames/*
228+
rd_("fcrate1fcrate2")
229+
```
230+
200231
### `--document-hidden-items`: Show items that are `#[doc(hidden)]`
201232
<span id="document-hidden-items"></span>
202233

0 commit comments

Comments
 (0)