Skip to content

Commit ef19886

Browse files
committed
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.
1 parent 9e64ce1 commit ef19886

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/doc/unstable-book/src/language-features/catch-expr.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,24 @@ The tracking issue for this feature is: [#31436]
66

77
------------------------
88

9-
The `catch_expr` feature adds support for a `catch` expression. The `catch`
10-
expression creates a new scope one can use the `?` operator in.
9+
The `catch_expr` feature adds support for `try` blocks. A `try`
10+
block creates a new scope one can use the `?` operator in.
11+
12+
```rust,ignore
13+
// This code needs the 2018 edition
1114
12-
```rust
1315
#![feature(catch_expr)]
1416
1517
use std::num::ParseIntError;
1618
17-
let result: Result<i32, ParseIntError> = do catch {
19+
let result: Result<i32, ParseIntError> = try {
1820
"1".parse::<i32>()?
1921
+ "2".parse::<i32>()?
2022
+ "3".parse::<i32>()?
2123
};
2224
assert_eq!(result, Ok(6));
2325
24-
let result: Result<i32, ParseIntError> = do catch {
26+
let result: Result<i32, ParseIntError> = try {
2527
"1".parse::<i32>()?
2628
+ "foo".parse::<i32>()?
2729
+ "3".parse::<i32>()?

0 commit comments

Comments
 (0)