diff options
| author | QuietMisdreavus <grey@quietmisdreavus.net> | 2017-11-04 14:50:26 -0500 |
|---|---|---|
| committer | QuietMisdreavus <grey@quietmisdreavus.net> | 2017-11-04 14:54:14 -0500 |
| commit | 5fbadfcdbee60531a8d439bf3703b47b509a2822 (patch) | |
| tree | 7f97fb08222616b386f6f8357f411aa813304df9 /src/doc/rustdoc | |
| parent | dcd343bfbca0a54ce861e7f4e9bcad0ac5ed2b4f (diff) | |
| download | rust-5fbadfcdbee60531a8d439bf3703b47b509a2822.tar.gz rust-5fbadfcdbee60531a8d439bf3703b47b509a2822.zip | |
rustdoc book: add #![doc(test(no_crate_inject))] and #![doc(test(attr(...)))]
Diffstat (limited to 'src/doc/rustdoc')
| -rw-r--r-- | src/doc/rustdoc/src/the-doc-attribute.md | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/doc/rustdoc/src/the-doc-attribute.md b/src/doc/rustdoc/src/the-doc-attribute.md index 978d7656bdd..aadd72d1c90 100644 --- a/src/doc/rustdoc/src/the-doc-attribute.md +++ b/src/doc/rustdoc/src/the-doc-attribute.md @@ -103,6 +103,26 @@ to it in the docs. But if you include this: it will not. +### `test(no_crate_inject)` + +By default, `rustdoc` will automatically add a line with `extern crate my_crate;` into each doctest. +But if you include this: + +```rust,ignore +#![doc(test(no_crate_inject))] +``` + +it will not. + +### `test(attr(...))` + +This form of the `doc` attribute allows you to add arbitrary attributes to all your doctests. For +example, if you want your doctests to fail if they produce any warnings, you could add this: + +```rust,ignore +#![doc(test(attr(deny(warnings))))] +``` + ## At the item level These forms of the `#[doc]` attribute are used on individual items, to control how |
