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: docs/authoring.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,13 +47,15 @@ See <https://rust-lang.github.io/mdBook/format/theme/syntax-highlighting.html#su
47
47
48
48
Rust examples are tested via rustdoc, and should include the appropriate annotations:
49
49
50
-
*`edition2015` or `edition2018` --- If it is edition-specific (see `book.toml` for the default).
50
+
*`edition2015`, `edition2018`, etc. --- If it is edition-specific (see `book.toml` for the default).
51
51
*`no_run` --- The example should compile successfully, but should not be executed.
52
52
*`should_panic` --- The example should compile and run, but produce a panic.
53
53
*`compile_fail` --- The example is expected to fail to compile.
54
54
*`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.
55
55
*`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.
56
56
57
+
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.
0 commit comments