Catch expression does not require semicolon to be a statement
This commit is contained in:
parent
5e25dc9966
commit
9a7cb9398d
2 changed files with 8 additions and 1 deletions
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,4 +71,10 @@ pub fn main() {
|
|||
Ok(&my_string)
|
||||
};
|
||||
assert_eq!(res, Ok("test"));
|
||||
|
||||
do catch {
|
||||
()
|
||||
}
|
||||
|
||||
();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue