diff options
| author | Aleksey Kladov <aleksey.kladov@gmail.com> | 2017-04-01 18:11:17 +0300 |
|---|---|---|
| committer | Aleksey Kladov <aleksey.kladov@gmail.com> | 2017-07-18 03:42:21 +0300 |
| commit | 9a7cb9398dc23643bce69220cd63480aa7775515 (patch) | |
| tree | b76c7dc1302c1c552e7bf167761b91fd8ff81b1d | |
| parent | 5e25dc9966c28f057b33045be9d4967815dcba05 (diff) | |
| download | rust-9a7cb9398dc23643bce69220cd63480aa7775515.tar.gz rust-9a7cb9398dc23643bce69220cd63480aa7775515.zip | |
Catch expression does not require semicolon to be a statement
| -rw-r--r-- | src/libsyntax/parse/classify.rs | 3 | ||||
| -rw-r--r-- | src/test/run-pass/catch-expr.rs | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/libsyntax/parse/classify.rs b/src/libsyntax/parse/classify.rs index d9f76ce3592..b8e02556625 100644 --- a/src/libsyntax/parse/classify.rs +++ b/src/libsyntax/parse/classify.rs @@ -30,7 +30,8 @@ pub fn expr_requires_semi_to_be_stmt(e: &ast::Expr) -> bool { ast::ExprKind::While(..) | ast::ExprKind::WhileLet(..) | ast::ExprKind::Loop(..) | - ast::ExprKind::ForLoop(..) => false, + ast::ExprKind::ForLoop(..) | + ast::ExprKind::Catch(..) => false, _ => true, } } diff --git a/src/test/run-pass/catch-expr.rs b/src/test/run-pass/catch-expr.rs index 5a757161a78..310b6ea5bcc 100644 --- a/src/test/run-pass/catch-expr.rs +++ b/src/test/run-pass/catch-expr.rs @@ -71,4 +71,10 @@ pub fn main() { Ok(&my_string) }; assert_eq!(res, Ok("test")); + + do catch { + () + } + + (); } |
