about summary refs log tree commit diff
path: root/src/librustc_parse
diff options
context:
space:
mode:
authorBastian Kauschke <bastian_kauschke@hotmail.de>2020-04-14 17:45:00 +0200
committerBastian Kauschke <bastian_kauschke@hotmail.de>2020-04-14 18:39:20 +0200
commit81a3cd7278f6117401b6b441485154e6ecf2f8c9 (patch)
tree7a4e2351f60abf75a1777fb68ad733c2131ab1a1 /src/librustc_parse
parent2765f426da76fd7b7b9bd377de7f92dd181387c0 (diff)
downloadrust-81a3cd7278f6117401b6b441485154e6ecf2f8c9.tar.gz
rust-81a3cd7278f6117401b6b441485154e6ecf2f8c9.zip
allow try as scrutinee, e.g. `match try ...`
Diffstat (limited to 'src/librustc_parse')
-rw-r--r--src/librustc_parse/parser/expr.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/librustc_parse/parser/expr.rs b/src/librustc_parse/parser/expr.rs
index cbff99f8da6..4e3c5fa63de 100644
--- a/src/librustc_parse/parser/expr.rs
+++ b/src/librustc_parse/parser/expr.rs
@@ -1846,11 +1846,9 @@ impl<'a> Parser<'a> {
     }
 
     fn is_try_block(&self) -> bool {
-        self.token.is_keyword(kw::Try) &&
-        self.look_ahead(1, |t| *t == token::OpenDelim(token::Brace)) &&
-        self.token.uninterpolated_span().rust_2018() &&
-        // Prevent `while try {} {}`, `if try {} {} else {}`, etc.
-        !self.restrictions.contains(Restrictions::NO_STRUCT_LITERAL)
+        self.token.is_keyword(kw::Try)
+            && self.look_ahead(1, |t| *t == token::OpenDelim(token::Brace))
+            && self.token.uninterpolated_span().rust_2018()
     }
 
     /// Parses an `async move? {...}` expression.