You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: reference-dev-guide/src/examples.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,24 +12,24 @@ See the [mdBook supported languages] for a list of supported languages.
12
12
13
13
## rustdoc attributes
14
14
15
-
Rust examples are [tested via rustdoc], and should include the appropriate annotations:
15
+
Rust examples are [tested via rustdoc] and should include the appropriate annotations:
16
16
17
-
-`edition2015`, `edition2018`, etc. --- If it is edition-specific (see `book.toml` for the default).
18
-
-`no_run` --- The example should compile successfully, but should not be executed.
19
-
-`should_panic` --- The example should compile and run, but produce a panic.
17
+
-`edition2015`, `edition2018`, etc. --- Use if it is edition-specific (see `book.toml` for the default).
18
+
-`no_run` --- The example should compile successfully but should not be executed.
19
+
-`should_panic` --- The example should compile and run but produce a panic.
20
20
-`compile_fail` --- The example is expected to fail to compile.
21
-
-`ignore` --- The example shouldn't be built or tested. This should be avoided if possible. Usually this is only necessary when the testing framework does not support it (such as external crates or modules, or a proc-macro), or it contains pseudo-code which is not valid Rust. An HTML comment such as `<!-- ignore: requires extern crate -->` should be placed before the example to explain why it is ignored.
22
-
-`Exxxx` --- If the example is expected to fail to compile with a specific error code, include that code so that rustdoc will check that the expected code is used.
21
+
-`ignore` --- The example shouldn't be built or tested. This should be avoided if possible. Usually, this is only necessary when the testing framework does not support it (such as external crates, modules, or a proc-macro) or when it contains pseudo-code that is not valid Rust. An HTML comment, such as `<!-- ignore: requires extern crate -->`, should be placed before the example to explain why it is ignored.
22
+
-`Exxxx` --- If the example is expected to fail to compile with a specific error code, include that code so that `rustdoc` checks that the expected code is used.
23
23
24
24
See the [rustdoc documentation] for more detail.
25
25
26
26
## Combining examples
27
27
28
-
When demonstrating success cases, many such cases may be included in a single code block. For failure cases, however, each example must appear in a separate code block so that the tests can ensure that each case indeed fails and fails with the appropriate error code or codes.
28
+
When demonstrating success cases, multiple cases may be included in a single code block. For failure cases, however, each example must appear in a separate code block so that the tests can ensure that each case indeed fails with the appropriate error code.
29
29
30
30
## Testing examples
31
31
32
-
The Rust code blocks are tested in CI. You can verify the samples pass by running [`mdbook test`].
32
+
The Rust code blocks are tested in CI. You can verify that the samples pass by running [`mdbook test`].
0 commit comments