Skip to content

Commit bfb63c3

Browse files
committed
feat(rustdoc): stabilize --emit flag
1 parent 04ff05c commit bfb63c3

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

src/doc/rustdoc/src/command-line-arguments.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,36 @@ When `rustdoc` receives this flag, it will print an extra "Version (version)" in
440440
the crate root's docs. You can use this flag to differentiate between different versions of your
441441
library's documentation.
442442

443+
## `--emit`: control the types of output for rustdoc to emit
444+
445+
This flag controls the types of output by rustdoc. It accepts a comma-separated
446+
list of values, and may be specified multiple times. The valid emit kinds are:
447+
448+
- `unversioned-shared-resources` --- Current a no-op option.
449+
- `toolchain-shared-resources` --- Generates shared static files that their
450+
contents are tied to a specific toolchain version. These are written with a
451+
filename that includes a hash of their contents, so they are safe to cache with the
452+
change if the toolchain version or their contents change, so it is safe to
453+
cache them wit the `Cache-Control: immutable` directive.
454+
- `invocation-specific` --- Generates files based on the crate(s) being
455+
documented. These file names need to be deterministic so there is no
456+
content-hash in their file names.
457+
- `dep-info` --- Generates a file with Makefile syntax that indicates all the
458+
source files that were loaded to document the crate. The default output
459+
filename is `CRATE_NAME.d`. This emit type can can optionally be followed by
460+
`=` to specify an explicit output path, for example,
461+
`--emit=dep-info=/path/to/foo.d`. The output can be sent to stdout by
462+
specifying `-` as the path (e.g., `--emit=dep-info=-`).
463+
464+
Using this flag looks like this:
465+
466+
```bash
467+
$ rustdoc src/lib.rs --emit=toolchain-shared-resources,invocation-specific,dep-info=/path/too/build/cache/foo.d
468+
```
469+
470+
If not specified, the default emit types would be
471+
`--emit=toolchain-shared-resources,invocation-specific`.
472+
443473
## `-`: load source code from the standard input
444474

445475
If you specify `-` as the INPUT on the command line, then `rustdoc` will read the

src/librustdoc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ fn opts() -> Vec<RustcOptGroup> {
561561
"",
562562
),
563563
opt(
564-
Unstable,
564+
Stable,
565565
Multi,
566566
"",
567567
"emit",

0 commit comments

Comments
 (0)