diff options
| author | Duddino <rezziandrea106@gmail.com> | 2020-04-17 14:07:44 +0200 |
|---|---|---|
| committer | Duddino <rezziandrea106@gmail.com> | 2020-04-17 14:08:08 +0200 |
| commit | ba61fe432a13e63ea81112dd63d60b28cc63b40e (patch) | |
| tree | 5dffc4167aa4cd64313900213c6690e694f77d5b /src/librustc_parse/parser/expr.rs | |
| parent | 534a41a32952d36ec73656357777ebbea707aeb4 (diff) | |
| download | rust-ba61fe432a13e63ea81112dd63d60b28cc63b40e.tar.gz rust-ba61fe432a13e63ea81112dd63d60b28cc63b40e.zip | |
Account for use of `try!()` in 2018 edition and guide users in the right direction
Diffstat (limited to 'src/librustc_parse/parser/expr.rs')
| -rw-r--r-- | src/librustc_parse/parser/expr.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/librustc_parse/parser/expr.rs b/src/librustc_parse/parser/expr.rs index 4e3c5fa63de..907a8c2dce2 100644 --- a/src/librustc_parse/parser/expr.rs +++ b/src/librustc_parse/parser/expr.rs @@ -1001,11 +1001,13 @@ impl<'a> Parser<'a> { fn parse_lit_expr(&mut self, attrs: AttrVec) -> PResult<'a, P<Expr>> { let lo = self.token.span; + let is_try = self.token.is_keyword(kw::Try); match self.parse_opt_lit() { Some(literal) => { let expr = self.mk_expr(lo.to(self.prev_token.span), ExprKind::Lit(literal), attrs); self.maybe_recover_from_bad_qpath(expr, true) } + None if is_try => Err(self.try_macro_suggestion()), None => Err(self.expected_expression_found()), } } |
