Skip to content

Commit 178e305

Browse files
jyn514mark-i-m
authored andcommitted
Document rustdoc behavior
- `RUSTDOC_LOG` - `// aux-build:filename.rs` - `// build-aux-docs`
1 parent 4228f46 commit 178e305

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/compiler-debugging.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ your log filter, e.g. to get the logs for a specific module, you can run the
164164
compiler as `RUSTC_LOG=module::path rustc my-file.rs`. All `debug!` output will
165165
then appear in standard error.
166166
167+
If you are developing rustdoc, use `RUSTDOC_LOG` instead.
168+
167169
**Note that unless you use a very strict filter, the logger will emit a lot of
168170
output, so use the most specific module(s) you can (comma-separated if
169171
multiple)**. It's typically a good idea to pipe standard error to a file and
@@ -193,6 +195,12 @@ $ RUSTC_LOG=debug rustc +local my-file.rs 2>all-log
193195
# log rather than a `debug!` log so it will work on the official
194196
# compilers.
195197
$ RUSTC_LOG=rustc_trans=info rustc +local my-file.rs
198+
199+
# This will show the output of all `info!` calls made by rustdoc or any rustc library it calls.
200+
$ RUSTDOC_LOG=info rustdoc +local my-file.rs
201+
202+
# This will only show `debug!` calls made by rustdoc directly, not any `librustc*` crate.
203+
$ RUSTDOC_LOG=rustdoc rustdoc +local my-file.rs
196204
```
197205
198206
### How to keep or remove `debug!` and `trace!` calls from the resulting binary

src/rustdoc.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,11 @@ expect in various situations. These tests also use a supplementary script,
232232
XPath notation to get a precise look at the output. The full description of all
233233
the commands available to rustdoc tests is in `htmldocck.py`.
234234

235+
To use multiple crates in a rustdoc test, add `// aux-build:filename.rs`
236+
to the top of the test file. `filename.rs` should be placed in an `auxiliary`
237+
directory relative to the test file with the comment. If you need to build
238+
docs for the auxiliary file, use `// build-aux-docs`.
239+
235240
In addition, there are separate tests for the search index and rustdoc's
236241
ability to query it. The files in `src/test/rustdoc-js` each contain a
237242
different search query and the expected results, broken out by search tab.
@@ -240,3 +245,6 @@ runtime. These tests don't have as thorough of a writeup, but a broad example
240245
that features results in all tabs can be found in `basic.js`. The basic idea is
241246
that you match a given `QUERY` with a set of `EXPECTED` results, complete with
242247
the full item path of each item.
248+
249+
You can run tests using the name of the folder. For example,
250+
`x.py test --stage 1 src/test/rustdoc` will run the output tests using a stage1 rustdoc.

0 commit comments

Comments
 (0)