diff options
| -rw-r--r-- | src/doc/rustdoc/src/documentation-tests.md | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/doc/rustdoc/src/documentation-tests.md b/src/doc/rustdoc/src/documentation-tests.md index e4af122d0cb..dd8dcb7ff9b 100644 --- a/src/doc/rustdoc/src/documentation-tests.md +++ b/src/doc/rustdoc/src/documentation-tests.md @@ -323,6 +323,22 @@ compiles, then the test will fail. However please note that code failing with the current Rust release may work in a future release, as new features are added. +```text +/// Only runs on the 2018 edition. +/// +/// ```edition2018 +/// let result: Result<i32, ParseIntError> = try { +/// "1".parse::<i32>()? +/// + "2".parse::<i32>()? +/// + "3".parse::<i32>()? +/// }; +/// ``` +``` + +`edition2018` tells `rustdoc` that the code sample should be compiled the 2018 +edition of Rust. Similarly, you can specify `edition2015` to compile the code +with the 2015 edition. + ## Syntax reference The *exact* syntax for code blocks, including the edge cases, can be found |
