about summary refs log tree commit diff
path: root/src/doc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-09-22 14:26:15 +0000
committerbors <bors@rust-lang.org>2018-09-22 14:26:15 +0000
commitaf50e3822c4ceda60445c4a2adbb3bfa480ebd39 (patch)
tree34fd72c893b38708f648f92b4222ebc7ea625b9a /src/doc
parente7b5ba8661aa844a06c37f22d7af0afb1807d347 (diff)
parent48ec53ccaebe555832114612b6c3f8df183c0a91 (diff)
downloadrust-af50e3822c4ceda60445c4a2adbb3bfa480ebd39.tar.gz
rust-af50e3822c4ceda60445c4a2adbb3bfa480ebd39.zip
Auto merge of #54457 - pietroalbini:rollup, r=pietroalbini
Rollup of 16 pull requests

Successful merges:

 - #53652 (define copy_within on slices)
 - #54261 (Make `dyn` a keyword in the 2018 edition)
 - #54280 (remove (more) CAS API from Atomic* types where not natively supported)
 - #54323 (rustbuild: drop color handling)
 - #54350 (Support specifying edition in doc test)
 - #54370 (Improve handling of type bounds in `bit_set.rs`.)
 - #54371 (add -Zui-testing to rustdoc)
 - #54374 (Make 'proc_macro::MultiSpan' public.)
 - #54402 (Use no_default_libraries for all NetBSD flavors)
 - #54409 (Detect `for _ in in bar {}` typo)
 - #54412 (add applicability to span_suggestion call)
 - #54413 (Add UI test for deref recursion limit printing twice)
 - #54415 (parser: Tweak function parameter parsing to avoid rollback on succesfull path)
 - #54420 (Compress `Liveness` data some more.)
 - #54422 (Simplify slice's first(_mut) and last(_mut) with get)
 - #54446 (Unify christianpoveda's emails)

Failed merges:

 - #54058 (Introduce the partition_dedup/by/by_key methods for slices)

r? @ghost
Diffstat (limited to 'src/doc')
-rw-r--r--src/doc/rustdoc/src/documentation-tests.md16
-rw-r--r--src/doc/unstable-book/src/language-features/try-blocks.md4
2 files changed, 17 insertions, 3 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
diff --git a/src/doc/unstable-book/src/language-features/try-blocks.md b/src/doc/unstable-book/src/language-features/try-blocks.md
index 866b37a39a7..e342c260a73 100644
--- a/src/doc/unstable-book/src/language-features/try-blocks.md
+++ b/src/doc/unstable-book/src/language-features/try-blocks.md
@@ -9,9 +9,7 @@ The tracking issue for this feature is: [#31436]
 The `try_blocks` feature adds support for `try` blocks. A `try`
 block creates a new scope one can use the `?` operator in.
 
-```rust,ignore
-// This code needs the 2018 edition
-
+```rust,edition2018
 #![feature(try_blocks)]
 
 use std::num::ParseIntError;