diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2018-07-21 23:23:15 -0700 |
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2018-08-19 16:53:41 -0700 |
| commit | ef198867a73f24d4c3c50d246c1024a3bff3cee2 (patch) | |
| tree | 8b3dce7cf79fc4b0b1ed5990c442a57bb624ee53 | |
| parent | 9e64ce179903e610197e1d201a53471e9feb69f2 (diff) | |
| download | rust-ef198867a73f24d4c3c50d246c1024a3bff3cee2.tar.gz rust-ef198867a73f24d4c3c50d246c1024a3bff3cee2.zip | |
Fix the unstable book
I ignored the code block as I didn't see a way to run the doctest in 2018 -- I noticed the edition guide is also not testing its 2018 code snippits.
| -rw-r--r-- | src/doc/unstable-book/src/language-features/catch-expr.md | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/doc/unstable-book/src/language-features/catch-expr.md b/src/doc/unstable-book/src/language-features/catch-expr.md index 247333d841a..5295d642aa6 100644 --- a/src/doc/unstable-book/src/language-features/catch-expr.md +++ b/src/doc/unstable-book/src/language-features/catch-expr.md @@ -6,22 +6,24 @@ The tracking issue for this feature is: [#31436] ------------------------ -The `catch_expr` feature adds support for a `catch` expression. The `catch` -expression creates a new scope one can use the `?` operator in. +The `catch_expr` 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 #![feature(catch_expr)] use std::num::ParseIntError; -let result: Result<i32, ParseIntError> = do catch { +let result: Result<i32, ParseIntError> = try { "1".parse::<i32>()? + "2".parse::<i32>()? + "3".parse::<i32>()? }; assert_eq!(result, Ok(6)); -let result: Result<i32, ParseIntError> = do catch { +let result: Result<i32, ParseIntError> = try { "1".parse::<i32>()? + "foo".parse::<i32>()? + "3".parse::<i32>()? |
