]> git.proxmox.com Git - rustc.git/blob - src/doc/rustdoc/src/unstable-features.md
New upstream version 1.70.0+dfsg1
[rustc.git] / src / doc / rustdoc / src / unstable-features.md
1 # Unstable features
2
3 Rustdoc is under active development, and like the Rust compiler, some features are only available
4 on nightly releases. Some of these features are new and need some more testing before they're able to be
5 released to the world at large, and some of them are tied to features in the Rust compiler that are unstable. Several features here require a matching `#![feature(...)]` attribute to
6 enable, and thus are more fully documented in the [Unstable Book]. Those sections will link over
7 there as necessary.
8
9 [Unstable Book]: ../unstable-book/index.html
10
11 ## Nightly-gated functionality
12
13 These features just require a nightly build to operate. Unlike the other features on this page,
14 these don't need to be "turned on" with a command-line flag or a `#![feature(...)]` attribute in
15 your crate. This can give them some subtle fallback modes when used on a stable release, so be
16 careful!
17
18 ### Error numbers for `compile-fail` doctests
19
20 As detailed in [the chapter on documentation tests][doctest-attributes], you can add a
21 `compile_fail` attribute to a doctest to state that the test should fail to compile. However, on
22 nightly, you can optionally add an error number to state that a doctest should emit a specific error
23 number:
24
25 [doctest-attributes]: write-documentation/documentation-tests.html#attributes
26
27 ``````markdown
28 ```compile_fail,E0044
29 extern { fn some_func<T>(x: T); }
30 ```
31 ``````
32
33 This is used by the error index to ensure that the samples that correspond to a given error number
34 properly emit that error code. However, these error codes aren't guaranteed to be the only thing
35 that a piece of code emits from version to version, so this is unlikely to be stabilized in the
36 future.
37
38 Attempting to use these error numbers on stable will result in the code sample being interpreted as
39 plain text.
40
41 ### `missing_doc_code_examples` lint
42
43 This lint will emit a warning if an item doesn't have a code example in its documentation.
44 It can be enabled using:
45
46 ```rust,ignore (nightly)
47 #![deny(rustdoc::missing_doc_code_examples)]
48 ```
49
50 ## Extensions to the `#[doc]` attribute
51
52 These features operate by extending the `#[doc]` attribute, and thus can be caught by the compiler
53 and enabled with a `#![feature(...)]` attribute in your crate.
54
55 ### `#[doc(cfg)]`: Recording what platforms or features are required for code to be present
56
57 * Tracking issue: [#43781](https://github.com/rust-lang/rust/issues/43781)
58
59 You can use `#[doc(cfg(...))]` to tell Rustdoc exactly which platform items appear on.
60 This has two effects:
61
62 1. doctests will only run on the appropriate platforms, and
63 2. When Rustdoc renders documentation for that item, it will be accompanied by a banner explaining
64 that the item is only available on certain platforms.
65
66 `#[doc(cfg)]` is intended to be used alongside [`#[cfg(doc)]`][cfg-doc].
67 For example, `#[cfg(any(windows, doc))]` will preserve the item either on Windows or during the
68 documentation process. Then, adding a new attribute `#[doc(cfg(windows))]` will tell Rustdoc that
69 the item is supposed to be used on Windows. For example:
70
71 ```rust
72 #![feature(doc_cfg)]
73
74 /// Token struct that can only be used on Windows.
75 #[cfg(any(windows, doc))]
76 #[doc(cfg(windows))]
77 pub struct WindowsToken;
78
79 /// Token struct that can only be used on Unix.
80 #[cfg(any(unix, doc))]
81 #[doc(cfg(unix))]
82 pub struct UnixToken;
83
84 /// Token struct that is only available with the `serde` feature
85 #[cfg(feature = "serde")]
86 #[doc(cfg(feature = "serde"))]
87 #[derive(serde::Deserialize)]
88 pub struct SerdeToken;
89 ```
90
91 In this sample, the tokens will only appear on their respective platforms, but they will both appear
92 in documentation.
93
94 `#[doc(cfg(...))]` was introduced to be used by the standard library and currently requires the
95 `#![feature(doc_cfg)]` feature gate. For more information, see [its chapter in the Unstable
96 Book][unstable-doc-cfg] and [its tracking issue][issue-doc-cfg].
97
98 ### `doc_auto_cfg`: Automatically generate `#[doc(cfg)]`
99
100 * Tracking issue: [#43781](https://github.com/rust-lang/rust/issues/43781)
101
102 `doc_auto_cfg` is an extension to the `#[doc(cfg)]` feature. With it, you don't need to add
103 `#[doc(cfg(...)]` anymore unless you want to override the default behaviour. So if we take the
104 previous source code:
105
106 ```rust
107 #![feature(doc_auto_cfg)]
108
109 /// Token struct that can only be used on Windows.
110 #[cfg(any(windows, doc))]
111 pub struct WindowsToken;
112
113 /// Token struct that can only be used on Unix.
114 #[cfg(any(unix, doc))]
115 pub struct UnixToken;
116
117 /// Token struct that is only available with the `serde` feature
118 #[cfg(feature = "serde")]
119 #[derive(serde::Deserialize)]
120 pub struct SerdeToken;
121 ```
122
123 It'll render almost the same, the difference being that `doc` will also be displayed. To fix this,
124 you can use `doc_cfg_hide`:
125
126 ```rust
127 #![feature(doc_cfg_hide)]
128 #![doc(cfg_hide(doc))]
129 ```
130
131 And `doc` won't show up anymore!
132
133 [cfg-doc]: ./advanced-features.md
134 [unstable-doc-cfg]: ../unstable-book/language-features/doc-cfg.html
135 [issue-doc-cfg]: https://github.com/rust-lang/rust/issues/43781
136
137 ### Adding your trait to the "Notable traits" dialog
138
139 * Tracking issue: [#45040](https://github.com/rust-lang/rust/issues/45040)
140
141 Rustdoc keeps a list of a few traits that are believed to be "fundamental" to
142 types that implement them. These traits are intended to be the primary interface
143 for their implementers, and are often most of the API available to be documented
144 on their types. For this reason, Rustdoc will track when a given type implements
145 one of these traits and call special attention to it when a function returns one
146 of these types. This is the "Notable traits" dialog, accessible as a circled `i`
147 button next to the function, which, when clicked, shows the dialog.
148
149 In the standard library, some of the traits that are part of this list are
150 `Iterator`, `Future`, `io::Read`, and `io::Write`. However, rather than being
151 implemented as a hard-coded list, these traits have a special marker attribute
152 on them: `#[doc(notable_trait)]`. This means that you can apply this attribute
153 to your own trait to include it in the "Notable traits" dialog in documentation.
154
155 The `#[doc(notable_trait)]` attribute currently requires the `#![feature(doc_notable_trait)]`
156 feature gate. For more information, see [its chapter in the Unstable Book][unstable-notable_trait]
157 and [its tracking issue][issue-notable_trait].
158
159 [unstable-notable_trait]: ../unstable-book/language-features/doc-notable-trait.html
160 [issue-notable_trait]: https://github.com/rust-lang/rust/issues/45040
161
162 ### Exclude certain dependencies from documentation
163
164 * Tracking issue: [#44027](https://github.com/rust-lang/rust/issues/44027)
165
166 The standard library uses several dependencies which, in turn, use several types and traits from the
167 standard library. In addition, there are several compiler-internal crates that are not considered to
168 be part of the official standard library, and thus would be a distraction to include in
169 documentation. It's not enough to exclude their crate documentation, since information about trait
170 implementations appears on the pages for both the type and the trait, which can be in different
171 crates!
172
173 To prevent internal types from being included in documentation, the standard library adds an
174 attribute to their `extern crate` declarations: `#[doc(masked)]`. This causes Rustdoc to "mask out"
175 types from these crates when building lists of trait implementations.
176
177 The `#[doc(masked)]` attribute is intended to be used internally, and requires the
178 `#![feature(doc_masked)]` feature gate. For more information, see [its chapter in the Unstable
179 Book][unstable-masked] and [its tracking issue][issue-masked].
180
181 [unstable-masked]: ../unstable-book/language-features/doc-masked.html
182 [issue-masked]: https://github.com/rust-lang/rust/issues/44027
183
184 ### Document primitives
185
186 This is for Rust compiler internal use only.
187
188 Since primitive types are defined in the compiler, there's no place to attach documentation
189 attributes. The `#[rustc_doc_primitive = "..."]` attribute is used by the standard library to
190 provide a way to generate documentation for primitive types, and requires `#![feature(rustc_attrs)]`
191 to enable.
192
193 ### Document keywords
194
195 This is for Rust compiler internal use only.
196
197 Rust keywords are documented in the standard library (look for `match` for example).
198
199 To do so, the `#[doc(keyword = "...")]` attribute is used. Example:
200
201 ```rust
202 #![feature(rustdoc_internals)]
203
204 /// Some documentation about the keyword.
205 #[doc(keyword = "keyword")]
206 mod empty_mod {}
207 ```
208
209 ## Effects of other nightly features
210
211 These nightly-only features are not primarily related to Rustdoc,
212 but have convenient effects on the documentation produced.
213
214 ### `fundamental` types
215
216 Annotating a type with `#[fundamental]` primarily influences coherence rules about generic types,
217 i.e., they alter whether other crates can provide implementations for that type.
218 The unstable book [links to further information][unstable-fundamental].
219
220 [unstable-fundamental]: https://doc.rust-lang.org/unstable-book/language-features/fundamental.html
221
222 For documentation, this has an additional side effect:
223 If a method is implemented on `F<T>` (or `F<&T>`),
224 where `F` is a fundamental type,
225 then the method is not only documented at the page about `F`,
226 but also on the page about `T`.
227 In a sense, it makes the type transparent to Rustdoc.
228 This is especially convenient for types that work as annotated pointers,
229 such as `Pin<&mut T>`,
230 as it ensures that methods only implemented through those annotated pointers
231 can still be found with the type they act on.
232
233 If the `fundamental` feature's effect on coherence is not intended,
234 such a type can be marked as fundamental only for purposes of documentation
235 by introducing a custom feature and
236 limiting the use of `fundamental` to when documentation is built.
237
238 ## Unstable command-line arguments
239
240 These features are enabled by passing a command-line flag to Rustdoc, but the flags in question are
241 themselves marked as unstable. To use any of these options, pass `-Z unstable-options` as well as
242 the flag in question to Rustdoc on the command-line. To do this from Cargo, you can either use the
243 `RUSTDOCFLAGS` environment variable or the `cargo rustdoc` command.
244
245 ### `--markdown-before-content`: include rendered Markdown before the content
246
247 * Tracking issue: [#44027](https://github.com/rust-lang/rust/issues/44027)
248
249 Using this flag looks like this:
250
251 ```bash
252 $ rustdoc src/lib.rs -Z unstable-options --markdown-before-content extra.md
253 $ rustdoc README.md -Z unstable-options --markdown-before-content extra.md
254 ```
255
256 Just like `--html-before-content`, this allows you to insert extra content inside the `<body>` tag
257 but before the other content `rustdoc` would normally produce in the rendered documentation.
258 However, instead of directly inserting the file verbatim, `rustdoc` will pass the files through a
259 Markdown renderer before inserting the result into the file.
260
261 ### `--markdown-after-content`: include rendered Markdown after the content
262
263 Using this flag looks like this:
264
265 ```bash
266 $ rustdoc src/lib.rs -Z unstable-options --markdown-after-content extra.md
267 $ rustdoc README.md -Z unstable-options --markdown-after-content extra.md
268 ```
269
270 Just like `--html-after-content`, this allows you to insert extra content before the `</body>` tag
271 but after the other content `rustdoc` would normally produce in the rendered documentation.
272 However, instead of directly inserting the file verbatim, `rustdoc` will pass the files through a
273 Markdown renderer before inserting the result into the file.
274
275 ### `--playground-url`: control the location of the playground
276
277 Using this flag looks like this:
278
279 ```bash
280 $ rustdoc src/lib.rs -Z unstable-options --playground-url https://play.rust-lang.org/
281 ```
282
283 When rendering a crate's docs, this flag gives the base URL of the Rust Playground, to use for
284 generating `Run` buttons. Unlike `--markdown-playground-url`, this argument works for standalone
285 Markdown files *and* Rust crates. This works the same way as adding `#![doc(html_playground_url =
286 "url")]` to your crate root, as mentioned in [the chapter about the `#[doc]`
287 attribute][doc-playground]. Please be aware that the official Rust Playground at
288 https://play.rust-lang.org does not have every crate available, so if your examples require your
289 crate, make sure the playground you provide has your crate available.
290
291 [doc-playground]: write-documentation/the-doc-attribute.html#html_playground_url
292
293 If both `--playground-url` and `--markdown-playground-url` are present when rendering a standalone
294 Markdown file, the URL given to `--markdown-playground-url` will take precedence. If both
295 `--playground-url` and `#![doc(html_playground_url = "url")]` are present when rendering crate docs,
296 the attribute will take precedence.
297
298 ### `--sort-modules-by-appearance`: control how items on module pages are sorted
299
300 Using this flag looks like this:
301
302 ```bash
303 $ rustdoc src/lib.rs -Z unstable-options --sort-modules-by-appearance
304 ```
305
306 Ordinarily, when `rustdoc` prints items in module pages, it will sort them alphabetically (taking
307 some consideration for their stability, and names that end in a number). Giving this flag to
308 `rustdoc` will disable this sorting and instead make it print the items in the order they appear in
309 the source.
310
311 ### `--show-type-layout`: add a section to each type's docs describing its memory layout
312
313 Using this flag looks like this:
314
315 ```bash
316 $ rustdoc src/lib.rs -Z unstable-options --show-type-layout
317 ```
318
319 When this flag is passed, rustdoc will add a "Layout" section at the bottom of
320 each type's docs page that includes a summary of the type's memory layout as
321 computed by rustc. For example, rustdoc will show the size in bytes that a value
322 of that type will take in memory.
323
324 Note that most layout information is **completely unstable** and may even differ
325 between compilations.
326
327 ### `--resource-suffix`: modifying the name of CSS/JavaScript in crate docs
328
329 * Tracking issue: [#54765](https://github.com/rust-lang/rust/issues/54765)
330
331 Using this flag looks like this:
332
333 ```bash
334 $ rustdoc src/lib.rs -Z unstable-options --resource-suffix suf
335 ```
336
337 When rendering docs, `rustdoc` creates several CSS and JavaScript files as part of the output. Since
338 all these files are linked from every page, changing where they are can be cumbersome if you need to
339 specially cache them. This flag will rename all these files in the output to include the suffix in
340 the filename. For example, `light.css` would become `light-suf.css` with the above command.
341
342 ### `--extern-html-root-url`: control how rustdoc links to non-local crates
343
344 Using this flag looks like this:
345
346 ```bash
347 $ rustdoc src/lib.rs -Z unstable-options --extern-html-root-url some-crate=https://example.com/some-crate/1.0.1
348 ```
349
350 Ordinarily, when rustdoc wants to link to a type from a different crate, it looks in two places:
351 docs that already exist in the output directory, or the `#![doc(doc_html_root)]` set in the other
352 crate. However, if you want to link to docs that exist in neither of those places, you can use these
353 flags to control that behavior. When the `--extern-html-root-url` flag is given with a name matching
354 one of your dependencies, rustdoc use that URL for those docs. Keep in mind that if those docs exist
355 in the output directory, those local docs will still override this flag.
356
357 ### `-Z force-unstable-if-unmarked`
358
359 Using this flag looks like this:
360
361 ```bash
362 $ rustdoc src/lib.rs -Z force-unstable-if-unmarked
363 ```
364
365 This is an internal flag intended for the standard library and compiler that applies an
366 `#[unstable]` attribute to any dependent crate that doesn't have another stability attribute. This
367 allows `rustdoc` to be able to generate documentation for the compiler crates and the standard
368 library, as an equivalent command-line argument is provided to `rustc` when building those crates.
369
370 ### `--index-page`: provide a top-level landing page for docs
371
372 This feature allows you to generate an index-page with a given markdown file. A good example of it
373 is the [rust documentation index](https://doc.rust-lang.org/nightly/index.html).
374
375 With this, you'll have a page which you can custom as much as you want at the top of your crates.
376
377 Using `index-page` option enables `enable-index-page` option as well.
378
379 ### `--enable-index-page`: generate a default index page for docs
380
381 This feature allows the generation of a default index-page which lists the generated crates.
382
383 ### `--nocapture`: disable output capture for test
384
385 When this flag is used with `--test`, the output (stdout and stderr) of your tests won't be
386 captured by rustdoc. Instead, the output will be directed to your terminal,
387 as if you had run the test executable manually. This is especially useful
388 for debugging your tests!
389
390 ### `--check`: only checks the documentation
391
392 When this flag is supplied, rustdoc will type check and lint your code, but will not generate any
393 documentation or run your doctests.
394
395 Using this flag looks like:
396
397 ```bash
398 rustdoc -Z unstable-options --check src/lib.rs
399 ```
400
401 ### `--static-root-path`: control how static files are loaded in HTML output
402
403 Using this flag looks like this:
404
405 ```bash
406 $ rustdoc src/lib.rs -Z unstable-options --static-root-path '/cache/'
407 ```
408
409 This flag controls how rustdoc links to its static files on HTML pages. If you're hosting a lot of
410 crates' docs generated by the same version of rustdoc, you can use this flag to cache rustdoc's CSS,
411 JavaScript, and font files in a single location, rather than duplicating it once per "doc root"
412 (grouping of crate docs generated into the same output directory, like with `cargo doc`). Per-crate
413 files like the search index will still load from the documentation root, but anything that gets
414 renamed with `--resource-suffix` will load from the given path.
415
416 ### `--persist-doctests`: persist doctest executables after running
417
418 * Tracking issue: [#56925](https://github.com/rust-lang/rust/issues/56925)
419
420 Using this flag looks like this:
421
422 ```bash
423 $ rustdoc src/lib.rs --test -Z unstable-options --persist-doctests target/rustdoctest
424 ```
425
426 This flag allows you to keep doctest executables around after they're compiled or run.
427 Usually, rustdoc will immediately discard a compiled doctest after it's been tested, but
428 with this option, you can keep those binaries around for farther testing.
429
430 ### `--show-coverage`: calculate the percentage of items with documentation
431
432 * Tracking issue: [#58154](https://github.com/rust-lang/rust/issues/58154)
433
434 Using this flag looks like this:
435
436 ```bash
437 $ rustdoc src/lib.rs -Z unstable-options --show-coverage
438 ```
439
440 It generates something like this:
441
442 ```bash
443 +-------------------------------------+------------+------------+------------+------------+
444 | File | Documented | Percentage | Examples | Percentage |
445 +-------------------------------------+------------+------------+------------+------------+
446 | lib.rs | 4 | 100.0% | 1 | 25.0% |
447 +-------------------------------------+------------+------------+------------+------------+
448 | Total | 4 | 100.0% | 1 | 25.0% |
449 +-------------------------------------+------------+------------+------------+------------+
450 ```
451
452 If you want to determine how many items in your crate are documented, pass this flag to rustdoc.
453 When it receives this flag, it will count the public items in your crate that have documentation,
454 and print out the counts and a percentage instead of generating docs.
455
456 Some methodology notes about what rustdoc counts in this metric:
457
458 * Rustdoc will only count items from your crate (i.e. items re-exported from other crates don't
459 count).
460 * Docs written directly onto inherent impl blocks are not counted, even though their doc comments
461 are displayed, because the common pattern in Rust code is to write all inherent methods into the
462 same impl block.
463 * Items in a trait implementation are not counted, as those impls will inherit any docs from the
464 trait itself.
465 * By default, only public items are counted. To count private items as well, pass
466 `--document-private-items` at the same time.
467
468 Public items that are not documented can be seen with the built-in `missing_docs` lint. Private
469 items that are not documented can be seen with Clippy's `missing_docs_in_private_items` lint.
470
471 Calculating code examples follows these rules:
472
473 1. These items aren't accounted by default:
474 * struct/union field
475 * enum variant
476 * constant
477 * static
478 * typedef
479 2. If one of the previously listed items has a code example, then it'll be counted.
480
481 #### JSON output
482
483 When using `--output-format json` with this option, it will display the coverage information in
484 JSON format. For example, here is the JSON for a file with one documented item and one
485 undocumented item:
486
487 ```rust
488 /// This item has documentation
489 pub fn foo() {}
490
491 pub fn no_documentation() {}
492 ```
493
494 ```json
495 {"no_std.rs":{"total":3,"with_docs":1,"total_examples":3,"with_examples":0}}
496 ```
497
498 Note that the third item is the crate root, which in this case is undocumented.
499
500 ### `-w`/`--output-format`: output format
501
502 `--output-format json` emits documentation in the experimental
503 [JSON format](https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc_json_types/). `--output-format html` has no effect,
504 and is also accepted on stable toolchains.
505
506 JSON Output for toolchain crates (`std`, `alloc`, `core`, `test`, and `proc_macro`)
507 is available via the `rust-docs-json` rustup component.
508
509 ```shell
510 rustup component add --toolchain nightly rust-docs-json
511 ```
512
513 Then the json files will be present in the `share/doc/rust/json/` directory
514 of the rustup toolchain directory.
515
516 It can also be used with `--show-coverage`. Take a look at its
517 [documentation](#--show-coverage-calculate-the-percentage-of-items-with-documentation) for more
518 information.
519
520 ### `--enable-per-target-ignores`: allow `ignore-foo` style filters for doctests
521
522 * Tracking issue: [#64245](https://github.com/rust-lang/rust/issues/64245)
523
524 Using this flag looks like this:
525
526 ```bash
527 $ rustdoc src/lib.rs -Z unstable-options --enable-per-target-ignores
528 ```
529
530 This flag allows you to tag doctests with compiletest style `ignore-foo` filters that prevent
531 rustdoc from running that test if the target triple string contains foo. For example:
532
533 ```rust
534 ///```ignore-foo,ignore-bar
535 ///assert!(2 == 2);
536 ///```
537 struct Foo;
538 ```
539
540 This will not be run when the build target is `super-awesome-foo` or `less-bar-awesome`.
541 If the flag is not enabled, then rustdoc will consume the filter, but do nothing with it, and
542 the above example will be run for all targets.
543 If you want to preserve backwards compatibility for older versions of rustdoc, you can use
544
545 ```rust
546 ///```ignore,ignore-foo
547 ///assert!(2 == 2);
548 ///```
549 struct Foo;
550 ```
551
552 In older versions, this will be ignored on all targets, but on newer versions `ignore-gnu` will
553 override `ignore`.
554
555 ### `--runtool`, `--runtool-arg`: program to run tests with; args to pass to it
556
557 * Tracking issue: [#64245](https://github.com/rust-lang/rust/issues/64245)
558
559 Using these options looks like this:
560
561 ```bash
562 $ rustdoc src/lib.rs -Z unstable-options --runtool runner --runtool-arg --do-thing --runtool-arg --do-other-thing
563 ```
564
565 These options can be used to run the doctest under a program, and also pass arguments to
566 that program. For example, if you want to run your doctests under valgrind you might run
567
568 ```bash
569 $ rustdoc src/lib.rs -Z unstable-options --runtool valgrind
570 ```
571
572 Another use case would be to run a test inside an emulator, or through a Virtual Machine.
573
574 ### `--with-examples`: include examples of uses of items as documentation
575
576 * Tracking issue: [#88791](https://github.com/rust-lang/rust/issues/88791)
577
578 This option, combined with `--scrape-examples-target-crate` and
579 `--scrape-examples-output-path`, is used to implement the functionality in [RFC
580 #3123](https://github.com/rust-lang/rfcs/pull/3123). Uses of an item (currently
581 functions / call-sites) are found in a crate and its reverse-dependencies, and
582 then the uses are included as documentation for that item. This feature is
583 intended to be used via `cargo doc --scrape-examples`, but the rustdoc-only
584 workflow looks like:
585
586 ```bash
587 $ rustdoc examples/ex.rs -Z unstable-options \
588 --extern foobar=target/deps/libfoobar.rmeta \
589 --scrape-examples-target-crate foobar \
590 --scrape-examples-output-path output.calls
591 $ rustdoc src/lib.rs -Z unstable-options --with-examples output.calls
592 ```
593
594 First, the library must be checked to generate an `rmeta`. Then a
595 reverse-dependency like `examples/ex.rs` is given to rustdoc with the target
596 crate being documented (`foobar`) and a path to output the calls
597 (`output.calls`). Then, the generated calls file can be passed via
598 `--with-examples` to the subsequent documentation of `foobar`.
599
600 To scrape examples from test code, e.g. functions marked `#[test]`, then
601 add the `--scrape-tests` flag.
602
603 ### `--check-cfg`: check configuration flags
604
605 * Tracking issue: [#82450](https://github.com/rust-lang/rust/issues/82450)
606
607 This flag accepts the same values as `rustc --check-cfg`, and uses it to check configuration flags.
608
609 Using this flag looks like this:
610
611 ```bash
612 $ rustdoc src/lib.rs -Z unstable-options \
613 --check-cfg='names()' --check-cfg='values(feature, "foo", "bar")'
614 ```
615
616 The example above check every well known names (`target_os`, `doc`, `test`, ... via `names()`)
617 and check the values of `feature`: `foo` and `bar`.
618
619 ### `--generate-link-to-definition`: Generate links on types in source code
620
621 * Tracking issue: [#89095](https://github.com/rust-lang/rust/issues/89095)
622
623 This flag enables the generation of links in the source code pages which allow the reader
624 to jump to a type definition.