From ef198867a73f24d4c3c50d246c1024a3bff3cee2 Mon Sep 17 00:00:00 2001 From: Scott McMurray Date: Sat, 21 Jul 2018 23:23:15 -0700 Subject: [PATCH] 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. --- .../src/language-features/catch-expr.md | 12 +++++++----- 1 file 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 = do catch { +let result: Result = try { "1".parse::()? + "2".parse::()? + "3".parse::()? }; assert_eq!(result, Ok(6)); -let result: Result = do catch { +let result: Result = try { "1".parse::()? + "foo".parse::()? + "3".parse::()?