Catch expression does not require semicolon to be a statement

This commit is contained in:
Aleksey Kladov 2017-04-01 18:11:17 +03:00
parent 5e25dc9966
commit 9a7cb9398d
2 changed files with 8 additions and 1 deletions

View file

@ -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,
}
}

View file

@ -71,4 +71,10 @@ pub fn main() {
Ok(&my_string)
};
assert_eq!(res, Ok("test"));
do catch {
()
}
();
}