From: Philip Munksgaard Date: Wed, 19 Sep 2018 14:35:25 +0000 (+0200) Subject: Add documentation about the edition flag X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=06b197582e1974e925925d28196b1ed867208ebf;p=rust.git Add documentation about the edition flag --- 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 = try { +/// "1".parse::()? +/// + "2".parse::()? +/// + "3".parse::()? +/// }; +/// ``` +``` + +`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